MHeironimus / ArduinoJoystickLibrary

An Arduino library that adds one or more joysticks to the list of HID devices an Arduino Leonardo or Arduino Micro can support.
GNU Lesser General Public License v3.0
2.1k stars 409 forks source link

ADS1115 ADC Issues #202

Open cartman-sp69 opened 3 years ago

cartman-sp69 commented 3 years ago

Description of Issue

I have hooked up an ADS1115 ADC to try and get 15 to 16 bit input resolution, however when I run the test only the last portion of the pot is read.

Technical Details

Sketch File that Reproduces Issue

include

include

include

Adafruit_ADS1115 ads;

Joystick_ Joystick(0x12, JOYSTICK_TYPE_JOYSTICK, 0, 0,false,false,false,true,true,true,false,false,false,false,false);

const bool initAutoSendState = true;

int16t rx, ry, rz;

void setup() {

Joystick.begin();

ads.begin(0x48); }

void loop() {

rx_ = ads.readADCSingleEnded(0); Joystick.setRxAxis(rx);

ry_ = ads.readADCSingleEnded(1); Joystick.setRyAxis(ry);

rz_ = ads.readADCSingleEnded(2); Joystick.setRzAxis(rz); delay(50);

Do you have any suggestions as to what I can do to fix this?

Thanks