//DigiJoystick test and usage documentation
#include "DigiJoystick.h"
void setup() {
pinMode(0, OUTPUT);
pinMode(1, OUTPUT);
}
void loop() {
// If not using plentiful DigiJoystick.delay() calls, make sure to
//DigiJoystick.update(); // call this at least every 50ms
// calling more often than that is fine
// this will actually only send the data every once in a while unless the data is different
// you can set the values from a raw byte array with:
// char myBuf[8] = {
// x, y, xrot, yrot, zrot, slider,
// buttonLowByte, buttonHighByte
// };
// DigiJoystick.setValues(myBuf);
// Or we can also set values like this:
DigiJoystick.setX((byte) 1); // scroll X left to right repeatedly
DigiJoystick.setButtons((byte) 1, (byte) 1);
digitalWrite(0, 1);
digitalWrite(1, 1);
// it's best to use DigiJoystick.delay() because it knows how to talk to
// the connected computer - otherwise the USB link can crash with the
// regular arduino delay() function
DigiJoystick.delay(500); // wait 50 milliseconds
DigiJoystick.setX((byte) 0); // scroll X left to right repeatedly
DigiJoystick.setButtons((byte) 1, (byte) 0);
digitalWrite(0, 0);
digitalWrite(1, 0);
}