Thursday, 16 April 2015

Possible Coding

I found this code on http://www.instructables.com/id/Arduino-leonardo-usb-steering-wheel/



void setup()
{
  Serial.begin(57600);
  pinMode(13, OUTPUT);
  joySt.xAxis = 0;
  joySt.yAxis = 0;
  joySt.zAxis = 0;
  joySt.xRotAxis = 0;
  joySt.yRotAxis = 0;
  joySt.zRotAxis = 0;
  joySt.throttle = 0;
  joySt.rudder = 0;
  joySt.hatSw1 = 0;
  joySt.hatSw2 = 0;
  joySt.buttons = 0;
}
void loop()
{
  Serial.write("DIY USB joystick V1 by the nerdling");
  joySt.xAxis = analogRead(A4)/4;
  joySt.yAxis = analogRead(A5)/4;
  joySt.rudder = analogRead(A3)/4;
  Joystick.setState(&joySt);

}

No comments:

Post a Comment