hey guys i installed teensyduino and teensy 3.2 board no problem. tried to just verify this code and got the error message below. what's this about? i remember when i got the leonardo set up for joystick use, i had to add some files to my arduino IDE install folder. did perhaps installing teensyduino botch those up?
#define STICK_X A0
#define STICK_Y A1
#define OVERVAL 0
int Xstick;
int Ystick;
int Temp;
int myPins[] = {0, 1, 2, 3, 4, 5, 6, 7};
boolean buttonState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
boolean oState[] = {true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true};
void setup()
{
for (int i = 0 ; i < 8 ; i++)
{
pinMode(myPins[i], INPUT_PULLUP);
}
Joystick.begin(false);
}
void loop()
{
// X axis computations
Xstick = map(analogRead(STICK_X), OVERVAL, 1024 - OVERVAL, -127, 127);
Xstick = constrain(Xstick, -127, 127);
Joystick.setXAxis(Xstick);
// Y axis computations
Ystick = map(analogRead(STICK_Y), OVERVAL, 1024 - OVERVAL, 127, -127);
Ystick = constrain(Ystick, -127, 127);
Joystick.setYAxis(Ystick);
for (int i = 0 ; i < 8 ; i++)
{
buttonState[i] = digitalRead(myPins[i]); //read physical pin to corresponding buttonState
if(buttonState[i] != oState[i]) // check against previous button state, if changed do something
{
if(buttonState[i] == LOW) // button has been pressed
{
Joystick.pressButton(i); // press corresponding "joystick" button
}
else // button has been released
{
Joystick.releaseButton(i); // release corresponding "joystick" button
}
oState[i] = buttonState[i]; // save state to compare next time
}
Temp = analogRead(A2);
(Temp < -30) ? buttonState[8] = 1 : buttonState[8] = 0;
(Temp > 30) ? buttonState[9] = 1 : buttonState[9] = 0;
Temp = analogRead(A3);
(Temp < -30) ? buttonState[10] = 1 : buttonState[10] = 0;
(Temp > 30) ? buttonState[11] = 1 : buttonState[11] = 0;
Temp = analogRead(A4);
(Temp < -30) ? buttonState[12] = 1 : buttonState[12] = 0;
(Temp > 30) ? buttonState[13] = 1 : buttonState[13] = 0;
Temp = analogRead(A5);
(Temp < -30) ? buttonState[14] = 1 : buttonState[14] = 0;
(Temp > 30) ? buttonState[15] = 1 : buttonState[15] = 0;
// Update joystick state
Joystick.sendState();
}
}
Arduino: 1.6.5 (Windows 7), TD: 1.26, Board: "Teensy 3.2 / 3.1, Serial + Keyboard + Mouse + Joystick, 96 MHz optimized (overclock), US English"
Build options changed, rebuilding all
sketch_dec09a.ino: In function 'void setup()':
sketch_dec09a:20: error: no matching function for call to 'usb_joystick_class::begin(bool)'
sketch_dec09a.ino:20:23: note: candidate is:
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:28:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:1,
from sketch_dec09a.ino:5:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/usb_joystick.h:55:14: note: void usb_joystick_class::begin()
void begin(void) { }
^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/usb_joystick.h:55:14: note: candidate expects 0 arguments, 1 provided
sketch_dec09a.ino: In function 'void loop()':
sketch_dec09a:28: error: 'class usb_joystick_class' has no member named 'setXAxis'
sketch_dec09a:33: error: 'class usb_joystick_class' has no member named 'setYAxis'
sketch_dec09a:43: error: 'class usb_joystick_class' has no member named 'pressButton'
sketch_dec09a:47: error: 'class usb_joystick_class' has no member named 'releaseButton'
sketch_dec09a:69: error: 'class usb_joystick_class' has no member named 'sendState'
'class usb_joystick_class' has no member named 'sendState'
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.