Hello all,
I am a novice with Arduino, having been thinkering with it for about two weeks only.
I have a (genuine) Arduino Leonardo board, wich i've been working on for a few days, and it worked perfectly fine, but this evening (after about 24-hours of non-usage) i found out that the Leonardo no longer communicates (at all) with the PC.
I have the following "symptoms":
-
The "ON" LED is steadily on when the board is plugged in (as it should).
-
The "L" LED does not blink, except when the reset button is pressed (once for reset, or twice for bootloading).
-
The TX and RX LEDs are steadily off.
-
The board is not detected by Arduino IDE nor the Windows device manager.
-
Arduino IDE sketches cannot be uploaded to the board (the software remains stuck on the "uploading" phase).
-
I have tried all the possible USB ports on my PC, and i've rummaged trough all possible cables, without any change in result.
-
I am not aware of the board having overheated at any point in time, nor it has never been powered by anything besides the USB ports of my PC.
-
I am not aware of the board having ever suffered a short-circuit in it's (brief) service life.
-
The board was working perfectly fine the last time it was used.
-
The code it was running (for about two hours) the last time it was used is the follwing - a keyboard emulator code based on potentiometer positions (specifically, i am using Arduino as a base for a Train Simulator controller).
#include <Keyboard.h>
//Define Ports, button mappings and delays here
#define POWERHANDLE A0
#define BRAKEHANDLE A1
#define POWERINCREASE 'q'
#define POWERDECREASE 'z'
#define BRAKEINCREASE ';'
#define BRAKEDECREASE '.'
#define DELAYPOWER 10
#define DELAYBRAKE 10
int prevPower;
int prevBrake;
void setup() {
Serial.begin(9600);
Keyboard.begin();
}
void loop() {
//-----------------------Power handle code-----------------------
int sensorValuePower = analogRead(POWERHANDLE);
Serial.println(sensorValuePower);
int mappedPowerVal = map(sensorValuePower, 670, 995, 0, 8);
Serial.println(mappedPowerVal);
int trendPower = mappedPowerVal - prevPower;
int runtimePower;
if (trendPower > 0 )
{
// increasing
Serial.println("increasing");
runtimePower = trendPower * DELAYPOWER;
Serial.println("runtimePower="); Serial.println(runtimePower);
Keyboard.press(POWERINCREASE);
delay(runtimePower);
Keyboard.releaseAll();
}
else if (trendPower < 0)
{
// decreasing
Serial.println("decreasing");
int posValuePower = -trendPower;
runtimePower = posValuePower * DELAYPOWER;
Serial.println("runtimePower="); Serial.println(runtimePower);
Keyboard.press(POWERDECREASE);
delay(runtimePower);
Keyboard.releaseAll();
}
else
{
Serial.println("No Power Handle change detected");
}
prevPower = mappedPowerVal;
//-----------------------Brake handle code-----------------------
int sensorValueBrake = analogRead(BRAKEHANDLE);
Serial.println(sensorValueBrake);
int mappedBrakeVal = map(sensorValueBrake, 670, 995, 0, 8);
Serial.println(mappedBrakeVal);
int trendBrake = mappedBrakeVal - prevBrake;
int runtimeBrake;
if (trendBrake > 0 )
{
// increasing
Serial.println("increasing");
runtimeBrake = trendBrake * DELAYBRAKE;
Serial.println("runtimeBrake="); Serial.println(runtimeBrake);
Keyboard.press(BRAKEINCREASE);
delay(runtimeBrake);
Keyboard.releaseAll();
}
else if (trendBrake < 0)
{
// decreasing
Serial.println("decreasing");
int posValueBrake = -trendBrake;
runtimeBrake = posValueBrake * DELAYBRAKE;
Serial.println("runtimeBrake="); Serial.println(runtimeBrake);
Keyboard.press(BRAKEDECREASE);
delay(runtimeBrake);
Keyboard.releaseAll();
}
else
{
Serial.println("No Brake Handle change detected");
}
prevBrake = mappedBrakeVal;
delay(10);
}
Questions:
-
Is my board fried?
-
If it's not a write-off, is it salvageable? If yes, how?
-
Is the code part of the issue, if it is let to run for extended periods of time?
This is crucial, as i have an upcoming exhibition where i planned to have the simulator playable to the visiting pubblic, thus Arduino would need to stay on with the code running for up to four hours or so.


