send user-defined 26 bit codes
[Arduino] / light_sockets / light_sockets.ino
index 85818e0..c0ad002 100644 (file)
@@ -15,6 +15,8 @@ int int_1 = 900; // ms
 int wait  = 2000; // ms
 int repeat = 5; // times
 
+char code[27]; // 26 bits + null
+
 void setup() {
    pinMode(LED_PIN, OUTPUT);
    pinMode(TX_PIN, OUTPUT);
@@ -25,6 +27,7 @@ void setup() {
    Serial.println("w/s - 1 inteval +/- 100 ms");
    Serial.println("e/d - wait      +/- 100 ms");
    Serial.println("r/f - repeat    +/- 1");
+   Serial.println("U1000100110110000000000010 - send 26 bit user code");
 }
 
 
@@ -100,6 +103,12 @@ void loop() {
       Serial.print("repeat = ");
       Serial.println(repeat);
 
+    } else if (in == 'U') {
+      Serial.readBytesUntil('\n', code, sizeof(code));
+      Serial.print('U');
+      Serial.println( code );
+      send( code );
+
     } else {
       Serial.print("ignored ");
       Serial.println(in);