9d49fc9aafb1b30a9a5bd66ca1d610e45141da4a
[Arduino] / light_sockets / light_sockets.ino
1 #define TX_PIN 7
2 #define LED_PIN 13
3
4 char *code = "1000100110110000000000010";
5 //char *code = "1011001001011111000000010";
6
7 void setup() {
8    pinMode(LED_PIN, OUTPUT);
9    pinMode(TX_PIN, OUTPUT);
10 }
11
12 void loop() {
13   digitalWrite(LED_PIN, HIGH);
14
15   for(int i = 0; i < strlen(code); i++) {
16     int i1 = 300;
17     int i2 = 900;
18     if (code[i] == '1' ) {
19       i1 = 900;
20       i2 = 300;
21     }
22     digitalWrite(TX_PIN, HIGH);
23     delayMicroseconds(i1);
24     digitalWrite(TX_PIN, LOW);
25     delayMicroseconds(i2);
26   }
27   
28   digitalWrite(LED_PIN, LOW);  
29   delay(3000);
30 }