Joystick Library


#1

Hey everybody:
I am developing some topics fro elementary school classes using the Starter + Electronic kit, I am using the Me Joystick Module, it works fine in the positive X and Y sector, but has an erratic behaviour in the other sectors, in other words, it gives me a good scale from 0 to 490, but it doesn’t work in the other from -490 to 0. But when I try to program the Orion from Arduino I have no problem… I am using the joystick.readX() and joystick.readY() API and works quite fine.
I think that there is a problem with the function used by Makeblock: Joystick_6.read(1) is used to read both X and Y axis (It read the same port!).
Although Arduino is a good environment, I would really like to use Mbock to program the Orion…
I am open to any suggestion
Thanks for all!
Martín


#2

Hi JMOG_94,

Do you use the latest verison mBlock 3.4.5? Here I test it and it works on for both side values.
What is the detailed issue for the other side value? Could you please test it again with latest version mBlock?
Once still the same issue, kindly take a video to show the details problem.


#3

Hi:
Thank you for the quick reply, yes I am using mBlock 3.4.5 in Windows 8 to program the Orion, and the problem is that in the negative coordinates the behaviour is not linear it can step from -167 to 0.
I am going to take a video as soon as possible.
greetings
Martin


#4

Sorry for the wait…
This is the video
Also sorry for the audio, I recorded it using my cellphone
Greetings
Martín


#5

Hi JMOG_94,

Thanks for your video.
I test the same program in your video on my Windows PC with mBlock 3.4.5 by the same way, both the positive Y and negative Y values work OK.

Since you mentioned your Joystick module works properly when program with Arduino software, then the joystic should be working either. You may try uninstall the current mBlock, download it and install again have a check.
Besides, do you have other PC to have a test?


#6

Well the thing is that in arduindo i am using a different API as I said before in arduino I use joystick.readX() and joystick.readY() API, and in your block you use the API Joystick.read() in both cases. And whenever I try your code on Arduino I get the same results as the makeblock source code
Greetings
Martin


#7

Hi JMOG_94,

Since it works ok when I do the test, I think there is no problem for makeblock course code.
Please double check if there is any mistake during operation was ignored. You may upgrade firmware for the Orion board with mBlock again, then double test the program.
Besides, from the program in the video, you use the Port 8 on Orion board, make sure that you have connected the Joystick to Port 8 on Orion board.
You can also test with other ports on Orion board but make sure it match the port in your program.


#8