Code:
void setup() { pinMode(13, OUTPUT); pinMode(8, OUTPUT); } void loop() { digitalWrite(13, HIGH); tone(8,440,300); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(900); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(2400); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,300); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); digitalWrite(13, HIGH); tone(8,440,300); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(300); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,900); digitalWrite(13, HIGH); delay(900); digitalWrite(13, LOW); delay(900); tone(8,440,300); digitalWrite(13, HIGH); delay(300); digitalWrite(13, LOW); delay(2400); }
This code is used for create an SOS message using a LED
First, you stablish the stetup with the value of the pin 13 as an output,
Then you create the setup, which we will use mostly this two commands:DigitalWrite() and delay
There two commands will make the led to activate or deactivate.
On digitalWrite, you must put the pin and if want to be activated "HIGH" or not "LOW"
The delay will select the time that the pin will be ON and OFF
For the SOS Morse code, consult Wikypedia for example for getting knowledge of the letters p atron
Simple rules on Morse Code:
For the sound you must add the tone() line behind the HIGH duration leds
With this, you can now create an SOS Morse code using a LED and Arduino