Last active
April 3, 2022 17:56
-
-
Save sbnsec/3eed4e8feb6626448f89a7f65709f724 to your computer and use it in GitHub Desktop.
arduino morse code encoder to led
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int led_pin = 1; | |
String code="-.-.-.--.--.--.-.-.-"; | |
int tl=500; | |
int pause=tl*2; | |
void setup(){} | |
void loop() { | |
for(int i=0;i<code.length();i++) | |
{ | |
if(code.charAt(i) == '-'){ | |
analogWrite(led_pin, 125); | |
delay(tl); | |
}else{ | |
analogWrite(led_pin, 0); | |
delay(tl); | |
} | |
} | |
analogWrite(led_pin, 0); | |
delay(pause); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment