-
Notifications
You must be signed in to change notification settings - Fork 30
/
BlinkSOS.ino
70 lines (58 loc) · 1.14 KB
/
BlinkSOS.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Blink SOS - An Arduino program that runs on Linux and MacOS natively.
*
* On Linux or Mac, type:
* * $ make
* * $ ./BlinkSOS.out
*
* Should print out the following:
*
* LED_BUILTIN: 1
* LED: 1
* SOS
* SOS
* SOS
* ...
*/
#include <Arduino.h>
#define LED LED_BUILTIN
#define LED_ON HIGH
#define LED_OFF LOW
void setup() {
#if ! defined(EPOXY_DUINO)
delay(1000); // some boards reboot twice
#endif
SERIAL_PORT_MONITOR.begin(115200);
while (!SERIAL_PORT_MONITOR); // For Leonardo/Micro
SERIAL_PORT_MONITOR.print(F("LED_BUILTIN: "));
SERIAL_PORT_MONITOR.println(LED_BUILTIN);
SERIAL_PORT_MONITOR.print(F("LED: "));
SERIAL_PORT_MONITOR.println(LED);
pinMode(LED, OUTPUT);
digitalWrite(LED, LED_OFF);
}
void longOn() {
digitalWrite(LED, LED_ON);
delay(500);
digitalWrite(LED, LED_OFF);
delay(200);
}
void shortOn() {
digitalWrite(LED, LED_ON);
delay(200);
digitalWrite(LED, LED_OFF);
delay(200);
}
void loop() {
SERIAL_PORT_MONITOR.println(F("SOS"));
shortOn();
shortOn();
shortOn();
longOn();
longOn();
longOn();
shortOn();
shortOn();
shortOn();
delay(1000);
}