Created
June 8, 2018 01:03
-
-
Save TheCuttlefish/55fd36556d6b9df4bad0c4329b78971f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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