Skip to content

Instantly share code, notes, and snippets.

@TheCuttlefish
Created June 8, 2018 01:03
Show Gist options
  • Save TheCuttlefish/55fd36556d6b9df4bad0c4329b78971f to your computer and use it in GitHub Desktop.
Save TheCuttlefish/55fd36556d6b9df4bad0c4329b78971f to your computer and use it in GitHub Desktop.
int morse[15] = {2,2,1,1,0,1,1,1,1,0,1,2,0,2,1};//zhan in morse
int total;
int current = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(LED_BUILTIN,OUTPUT);
total = sizeof( morse ) / sizeof( int );
}
void loop() {
digitalWrite(LED_BUILTIN, 1);
//short
if(morse[current] == 1){
delay(50);
}
//long
if(morse[current] == 2){
delay(500);
}
digitalWrite(LED_BUILTIN, 0);
//pause
delay(500);
current++;
if(current > total) current = 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment