Programming 2 joysticks - Raspberry Pi Forums


i have made program , can't read 2 joysticks separately. have verified both joysticks work fine separately read 1 joystick when used together.

code: select all

void loop() {   // read analog inputs , set x-y position   joystick.x(analogread(0));   joystick.y(analogread(1));   joystick.x(analogread(2));   joystick.y(analogread(3)); 
or

code: select all

void loop() {   // read analog inputs , set x-y position   joystick.x(1, analogread(0));   joystick.y(1, analogread(1));   joystick.x(2, analogread(2));   joystick.y(2, analogread(3)); 
using teensy , loading code through teensyduino

i don't know library using, looks need instantiate 2 joystick objects, not one.

right now, code read channels 0 & 1, overwrite x , y when reading channels 2 & 3

don't know if second listing should work, not familiar joystick object.
raspigamer wrote:i have made program , can't read 2 joysticks separately. have verified both joysticks work fine separately read 1 joystick when used together.

code: select all

void loop() {   // read analog inputs , set x-y position   joystick.x(analogread(0));   joystick.y(analogread(1));   joystick.x(analogread(2));   joystick.y(analogread(3)); 
or

code: select all

void loop() {   // read analog inputs , set x-y position   joystick.x(1, analogread(0));   joystick.y(1, analogread(1));   joystick.x(2, analogread(2));   joystick.y(2, analogread(3)); 
using teensy , loading code through teensyduino


raspberrypi



Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code