Created
February 26, 2020 13:33
-
-
Save rafalw/94494561b668e3a39110ab982027d64f to your computer and use it in GitHub Desktop.
Ćwiczenie 1 (Arduino)
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
void setup() { | |
pinMode(LED_BUILTIN, OUTPUT); | |
Serial.begin(9600); | |
} | |
int i = 0; | |
void loop() { | |
Serial.println("Toss a letter to your teacher:"); | |
while (!Serial.available()) { | |
// po prostu czekaj... | |
} | |
int znak = Serial.read(); | |
if (znak == 88) { | |
Serial.println("OK!"); | |
i = 0; | |
while (i < 10) { | |
digitalWrite(LED_BUILTIN, 1); | |
delay(100); | |
digitalWrite(LED_BUILTIN, 0); | |
delay(100); | |
i++; | |
} | |
} else { | |
Serial.println("You're absolutely wrong!"); | |
} | |
} | |
//void loop() { | |
// Serial.println("Toss a letter to your teacher:"); | |
// if (Serial.available()) { | |
// int znak = Serial.read(); | |
// if (znak == 88) { | |
// Serial.println("OK!"); | |
// i = 0; | |
// while (i < 10) { | |
// digitalWrite(LED_BUILTIN, 1); | |
// delay(100); | |
// digitalWrite(LED_BUILTIN, 0); | |
// delay(100); | |
// i++; | |
// } | |
// } else { | |
// Serial.println("You're absolutely wrong!"); | |
// } | |
// } | |
//} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment