Semi nube to arduino, total nube to programming. I enetered inn a sketch that I screen shotted.... To The T btw. But getting this error messege.."C:\Users\G\Documents\Arduino\Sequential_Shifter\Sequential_Shifter.ino: In function 'void setup()':
C:\Users\G\Documents\Arduino\Sequential_Shifter\Sequential_Shifter.ino:6:10: error: expected unqualified-id before '.' token
Joystick.begin();
^
C:\Users\G\Documents\Arduino\Sequential_Shifter\Sequential_Shifter.ino: In function 'void loop()':
C:\Users\G\Documents\Arduino\Sequential_Shifter\Sequential_Shifter.ino:14:6: error: expected '(' before 'int'
for int index = 0; index < 2; index++)
^~~
C:\Users\G\Documents\Arduino\Sequential_Shifter\Sequential_Shifter.ino:18:14: error: expected unqualified-id before '.' token
{Joystick.setButton(index, currentButtonState);
^
exit status 1
here is the sketch.. can someone please help
#include <Joystick.h>
void setup() {
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
Joystick.begin();
}
const int pinToButtonMap = 2;
int lastButtonState[4] = {0,0};
void loop() {
for int index = 0; index < 2; index++)
{
int currentButtonState = !digitalRead(index + pinToButtonMap);
if (currentButtonState != lastButtonState[index])
{Joystick.setButton(index, currentButtonState);
lastButtonState[index] = currentButtonState;}
}
delay(50);
}