Skip to content

Instantly share code, notes, and snippets.

@sbnsec
Last active April 3, 2022 17:56
Show Gist options
  • Save sbnsec/3eed4e8feb6626448f89a7f65709f724 to your computer and use it in GitHub Desktop.
Save sbnsec/3eed4e8feb6626448f89a7f65709f724 to your computer and use it in GitHub Desktop.
arduino morse code encoder to led
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