X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;ds=sidebyside;f=RF433_Sockets%2FRF433_Sockets.ino;fp=RF433_Sockets%2FRF433_Sockets.ino;h=45e4c72aa635c1e378be783f1e15901af5bd6971;hb=7409643cf148e24dbf9fdeadab8d9526209a9d8a;hp=0e2cd18313e8aba13920d4a23dc05ec54e4e20d4;hpb=da495474a6e79504906d501cb8c6e73f6ab0a84c;p=Arduino diff --git a/RF433_Sockets/RF433_Sockets.ino b/RF433_Sockets/RF433_Sockets.ino index 0e2cd18..45e4c72 100644 --- a/RF433_Sockets/RF433_Sockets.ino +++ b/RF433_Sockets/RF433_Sockets.ino @@ -16,11 +16,12 @@ void setup() { mySwitch.enableTransmit(10); // with sender wired in receiving doesn't work, pin #10 - Serial.print("press buttons on remote or send AB where A = socket (0..9), B = state (0 = off, 1 = on)\n"); + Serial.print("press buttons on remote or send AB where A = socket (0..9), B = state (0 = off, 1 = on)\nB00...00 (24 digits) to send binary\n"); } int serial_pos = 0; char serial_data[2]; // socket (0-9), state (0-1) +char binary_data[24]; void loop() { if (mySwitch.available()) { @@ -31,6 +32,12 @@ void loop() { } if (Serial.available() > 0) { char input = Serial.read(); + if ( input == 'B' ) { + Serial.readBytesUntil('\n', binary_data, sizeof(binary_data)); + Serial.print("send B"); + Serial.println( binary_data ); + mySwitch.send( binary_data ); + } else if ( input >= 0x30 && input <= 0x39 ) { input = input - 0x30; // ASCII to number serial_data[serial_pos++] = input;