loading
5Comments

Tell us about yourself!

Complete Your Profile
  • Arduino Leonardo/Micro as Game Controller/Joystick

    Hi MatthewH, thank you so much for your guidance. Actually everything worked fine using the Arduino serial monitor. The bug was caused by the Game Engine. It didn't work with higher port numbers. So after I changed to a lower port, everything works as expected :)

    View Instructable »
  • Arduino Leonardo/Micro as Game Controller/Joystick

    Actually it is compiling fine and the sketches separated into single sketches work fine, too. But if I execute them together, only the sketch for the poti joystick takes effect. Hopefully, I just did somme noob mistake ;)Basically the poti should control the x-axis of the gamepad, while a motor is controlled by serial messages (coming from a game engine).here is (a simplified version) of my code:int PWMPin = 9; // Motor connected to pin 9char character; // value 0-9 from serial monitor to control speedint speed;#include <Joystick.h>void setup(){pinMode(PWMPin, OUTPUT); // sets the pin as outputspeed = 0;Serial.begin(9600);Joystick.begin();}void loop(){//Joystick Poti Setupint thrust = analogRead(0);thrust = map(thrust, 0, 1023, -127, 127);Joystick.setXAxis(thrust); ...see more »Actually it is compiling fine and the sketches separated into single sketches work fine, too. But if I execute them together, only the sketch for the poti joystick takes effect. Hopefully, I just did somme noob mistake ;)Basically the poti should control the x-axis of the gamepad, while a motor is controlled by serial messages (coming from a game engine).here is (a simplified version) of my code:int PWMPin = 9; // Motor connected to pin 9char character; // value 0-9 from serial monitor to control speedint speed;#include <Joystick.h>void setup(){pinMode(PWMPin, OUTPUT); // sets the pin as outputspeed = 0;Serial.begin(9600);Joystick.begin();}void loop(){//Joystick Poti Setupint thrust = analogRead(0);thrust = map(thrust, 0, 1023, -127, 127);Joystick.setXAxis(thrust); //motor Setupdelay(100);//delay for stabilitywhile(Serial.available() > 0) { character=Serial.read()-48; //read ASCII speed = map(character,0,9,0,255); analogWrite(PWMPin, speed); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 }}

    Hey MatthewH, thanks again for your great support! I ran into another issue. If I use "#include <Joystick.h>" other functions of the arduino Leonardo won't work anymore. I want to include a sketch that controls a motor parallel to the gamepad sketch. Is the any workaround?

    View Instructable »
  • Arduino Leonardo/Micro as Game Controller/Joystick

    Thanks again Matthew! I might need a workaround. I wonder how the motors are accessed by the ready made arduino gamepads: http://www.dfrobot.com/index.php?route=product/product&product_id=858#.Vt6j3PnhBhE

    View Instructable »
  • Arduino Leonardo/Micro as Game Controller/Joystick

    Hi MatthewH,thanks so much for your efforts, works perfectly!Do you think it is possible to implement force feedback functions for the joystick so I can use custom vibration motors?

    View Instructable »
  • chrissup followed Sensors, Tools, Arduino and Art channel 9 months ago