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 408 forks source link

ADS1115 and Joystick Library refuses to upload #106

Closed MorGuux closed 5 years ago

MorGuux commented 5 years ago

Description of Issue

Tested example sketch from Adafruit ADS1X15 library, uploaded to leonardo and tested in serial monitor. Runs fine.

Created a small sketch to get readings and set joystick axis's to values, doesn't upload. Seems to disconnect twice and then stay on uploading. After about 20 seconds, get "Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload" error.

Reuploaded the example sketch fine and tested, so the problem has to be with the sketch, or joystick lib. Messed around, disabling things, changing delay etc, nothing seems to make it upload.

Did try the setAxisRange on all three, but no change.

Technical Details

Sketch File that Reproduces Issue

#include <Joystick.h>

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Joystick_ Joystick;
Adafruit_ADS1115 ads;  /* Use this for the 16-bit version */

void setup() 
{

  // Initialize Joystick Library
  Joystick.begin();
  ads.begin();

}

void loop() 
{

  Joystick.setThrottle(ads.readADC_SingleEnded(0));
  Joystick.setRxAxis(ads.readADC_SingleEnded(1));
  Joystick.setRyAxis(ads.readADC_SingleEnded(2));

  delay(100);
}

Wiring Details

Nothing relevant as example sketch runs fine and returns all three pot inputs in 16bit signed format (-32767 to 32767), although obviously, no negative values will be returned as VCC = 5V.

MorGuux commented 5 years ago

Does upload, enabled verbose logging and get " avrdude done. Thank you.", don't know why I get the last warning, but it's irrelevant.