Hello, I'm trying to make a joystick app that will send the appropriate byte to the Arduino according to the joystick position (for example, 00000010 for right). However, my Arduino only keeps receiving 0 values. Could someone please point me out to where I'm going wrong? Thanks!
I don't see any documentation in AI2 on how the if/then block handles numerical condition values.
Remove the circled if/then test and let the data flow.
1 Like
Thank you, but the problem still persists though.
The problem might be from immediately resetting the global send_byte variable to 0 after each transmission.
These 2 draggable blocks should do the reset only after the drag ends, at TouchUp.
1 Like
Dear @Epistem,
please consider the picture below
I've just put three labels on the display panel in order to show the data created by the movement of the ball.
Try it and see what happens: your "if"statements are not implementing what you think they should do (I guess). Unless the values of x and y coordinates are outside the limits (< 20 and > 200) the value sent is always 0.
In the dsigner I've added this:
And I've switched off all the stuff related to the BT and timers. Just to see what happens to the x and y variables.
Give it a look
Cheers, Ugo.
1 Like