diff --git a/src/rx/rx.ino b/src/rx/rx.ino index 7fb3257..fdf4878 100644 --- a/src/rx/rx.ino +++ b/src/rx/rx.ino @@ -17,11 +17,11 @@ void setup() void loop() { uint8_t buf[2]; - size_t buf_len = sizeof(buf); // rip + size_t buf_len = sizeof(buf); - if (driver.recv(buf, &buf_len)){ - uint8_t value = buf[1]; - uint8_t ch = [buf]2; + if (driver.recv(buf, buf_len)){ + uint8_t value = buf[0]; + uint8_t ch = buf[1]; // 0 -> 3; 1 -> 5; 2 -> 6 ch = (ch ? ++ch + 3 : 3); diff --git a/src/tx/tx.ino b/src/tx/tx.ino index 38e6caa..206b6d3 100644 --- a/src/tx/tx.ino +++ b/src/tx/tx.ino @@ -15,12 +15,11 @@ void setup() void loop() { for(uint8_t i = 0; i < 3; i++) { - uint8_t val = (uint8_t)analogRead(i)/4; + int val = analogRead(i)/4; if(val >= lastval[i]+3 || val <= lastval[i]-3){ uint8_t msg[2] = { val, i }; - Serial.println(msg); driver.send((uint8_t *)msg, 2); driver.waitPacketSent();