lib-python
lib-python copied to clipboard
Joystick don't send 2nd value from blynk app
Hello, developers! This is an awesome module for Python and I want to explore it more. But I face an issue while working with it. Have some kinda vehicle that doesn't receive the 2nd parameter (I spin the joystick in different positions, below is an example of output) and I don't get why I can't read it from value[1] - is always a zero...
Code:
@blynk.handle_event('write V2')
def write_virtual_pin_handler(pin, value):
Controller(pin="V2", x_coord=value[0], y_coord=value[1])
print("Write: ", WRITE_EVENT_PRINT_MSG.format(pin, value))
Output:
Write: [WRITE_VIRTUAL_PIN_EVENT] Pin: V2 Value: '['52', '0']'
Hi ChuDoTvoreC! There is really some mess with continuous values ( I will try to ping Blynk App developers - this is real BUG ) In my case I had sometimes even negative values
2021-03-17 00:15:55,414 [INFO] Event: ['write v2'] -> (2, ['9999', '0'])
2021-03-17 00:15:55,603 [INFO] Event: ['write v2'] -> (2, ['9999', '-1015.52344'])
2021-03-17 00:15:55,614 [INFO] Event: ['write v2'] -> (2, ['9999', '-1581.873'])
But all OK with integer values ( In my case it was Android 2.27.27 App) - you can simply increase MAX value ( to have larger range of values) for example to 1024 and you will get smth like
2021-03-17 00:15:31,093 [INFO] Event: ['write v2'] -> (2, ['0', '578'])
2021-03-17 00:15:32,054 [INFO] Event: ['write v2'] -> (2, ['68', '578'])
Firsrt and Second values will be correct.
P.S Continuous values as you know can be disabled by disabling wave icon between MIN and MAX values