Hello everybody, i´m trying to use a joystick along with transceiver/receiver and print the X and Y axis, the problem is, negative values are displayed as 256(max value) - the negative number
, but i need to display them as negatives, the other problem is when i try to put the joystick at max range it gets displayed as a 0 in the receiver, despite it being shown as 256 in the receiver terminal
I haven't studied the library in detail but it does appear, at least on a cursory look, that the read and write methods are not symmetric.
Anyway, if you are writing then you probably have to write a byte (uint8_t), that is a value between 0 and 255.
size_t LoRaClass::write(uint8_t byte)
int LoRaClass::read()
If you want to work with negative numbers, it looks like you have to map these to the range 0 to 255 for transmission and un-map on receiving.
Have you got compiler warnings enabled in the IDE under preferences ?
07:44:53.844 -> LoRa Receiver
07:51:58.812 -> Received packet '-1000' with RSSI -71
07:52:00.827 -> Received packet '-900' with RSSI -71
07:52:02.840 -> Received packet '-800' with RSSI -71
07:52:04.886 -> Received packet '-700' with RSSI -71
07:52:06.898 -> Received packet '-600' with RSSI -66
07:52:08.908 -> Received packet '-500' with RSSI -66
07:52:10.926 -> Received packet '-400' with RSSI -71
07:52:12.973 -> Received packet '-300' with RSSI -66
07:52:14.978 -> Received packet '-200' with RSSI -71
07:52:16.997 -> Received packet '-100' with RSSI -71
07:52:19.037 -> Received packet '0' with RSSI -72
07:52:21.052 -> Received packet '100' with RSSI -71
07:52:23.096 -> Received packet '200' with RSSI -63
07:52:25.102 -> Received packet '300' with RSSI -71
07:52:27.122 -> Received packet '400' with RSSI -66
07:52:29.167 -> Received packet '500' with RSSI -71
07:52:31.176 -> Received packet '600' with RSSI -71
07:52:33.185 -> Received packet '700' with RSSI -71
07:52:35.234 -> Received packet '800' with RSSI -71
07:52:37.239 -> Received packet '900' with RSSI -71
07:52:39.285 -> Received packet '1000' with RSSI -70
07:52:41.295 -> Received packet '1100' with RSSI -71
07:52:43.308 -> Received packet '1200' with RSSI -71
07:52:45.331 -> Received packet '1300' with RSSI -71
07:52:47.377 -> Received packet '1400' with RSSI -71
07:52:49.391 -> Received packet '1500' with RSSI -71
07:52:51.412 -> Received packet '1600' with RSSI -65
07:52:53.454 -> Received packet '1700' with RSSI -71
07:52:55.473 -> Received packet '1800' with RSSI -71
07:52:57.489 -> Received packet '1900' with RSSI -71
code should work on Ra-02 Lora devices - just remove the statement specific to the 32u4