Skip to content

Downloaded file, Arduino IDE still doesn't recognize library #7

@BigChungus1009

Description

@BigChungus1009

Here is the code, pasted from this website
`#include <JoystickShield.h> //
JoystickShield Library

JoystickShield joystickShield; //
Create an instance of JoystickShield object

void setup() {

Serial.begin(9600);

delay(100);

// New calibration function

joystickShield.calibrateJoystick();

// Predefined Joystick to Pins 0 and 1.

// Change it if you are using a different joystick shield

// SetJoystickPins(0, 1);

// Predefined buttons to the following pins.

// Change it if you’re using a different joystick shield.

// setButtonPins(pinJoystickButton, pinUp, pinRight, pinDown, pinLeft,
pinF, pinE); // K,A,B,C,D,F,E

// To deactivate a button, use a pin outside of the range of the Arduino
e.g. 255, but not the above!

// setButtonPins(8, 2, 3, 4, 5, 7, 6);

}

void loop() {

joystickShield.processEvents(); // Process events

if (joystickShield.isUp()) {

Serial.println("Up") ;

}

if (joystickShield.isRightUp()) {

Serial.println("RightUp") ;

}

if (joystickShield.isRight()) {

Serial.println("Right") ;

}

if (joystickShield.isRightDown()) {

Serial.println("RightDown") ;

}

if (joystickShield.isDown()) {

Serial.println("Down") ;

}

if (joystickShield.isLeftDown()) {

Serial.println("LeftDown") ;

}

if (joystickShield.isLeft()) {

Serial.println("Left") ;

}

if (joystickShield.isLeftUp()) {

Serial.println("LeftUp") ;

}

if (joystickShield.isJoystickButton()) {

Serial.println("Joystick Clicked") ;

}

if (joystickShield.isUpButton()) {

Serial.println("Up Button Clicked") ;

}

if (joystickShield.isRightButton()) {

Serial.println("Right Button Clicked") ;

}

if (joystickShield.isDownButton()) {

Serial.println("Down Button Clicked") ;

}

if (joystickShield.isLeftButton()) {

Serial.println("Left Button Clicked") ;

}

// new eventfunctions

if (joystickShield.isEButton()) {

Serial.println("E Button Clicked") ;

}

if (joystickShield.isFButton()) {

Serial.println("F Button Clicked") ;

}

if (joystickShield.isNotCenter()) {

Serial.println("NotCenter") ;

}

// New position functions

Serial.print("x "); Serial.print(joystickShield.xAmplitude());
Serial.print(" y ");

Serial.println(joystickShield.yAmplitude());

delay(500);

}`
Do I have to put the files in a specific folder?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions