I have set up a circuit wtih 10 LEDs and 5 infrared distance sensors with code to light up certain LEDs It was all working fine and then i moved the circuit and the arduino and then used a DC adaptor, which i have used before at 6V and 7.5V plugged into the mains. The circuit then didnt seem to work. I have now rewired the circuit and re-programmed to test each LED. I have it plugged into the computer that it use to work on with the USB cable. They light up individualy but are very very dim.
Does anyone know what the issue could be? Is it to do with the current they receive? I have tested all the infrared sensors and they are working fine. Could something have been knocked or moved?
Its plugged into the computer when they are dim.... they never use to be ?
Is it just ten LEDs? Maybe you're drawing too much current. What are the LEDs rated at? Bear in mind that you should only draw a maximum of 200mA of current from the Arduino at any given time. It's also possible you're applying too much current, and they're burning out. I've killed quite a few LEDs, but they tend to dim out and die within a few seconds of applying too much current/voltage..
I hadnt done anyhing differently though? Would it burn out all 10? i havent changed how much current i am drawng though as i am still just using the USB cable?
I hadnt done anyhing differently though? Would it burn out all 10? i havent changed how much current i am drawng though as i am still just using the USB cable?
The USB cable provides up to 500mA of current, but you shouldn't draw more than 200mA. Like I said, I suppose the LEDs could slowly burn out over time if being over-currented/voltage(ized? :P).
You still didn't answer one of the questions though: What kind of LEDs are they, and are you using resistors of an appropriate value? :-?
when i plug in the AC/DC adaptor now set at 7.5V to the mains it it asslightly brighter LED than the USB but still not close to the brightnes it was. Does this mean the resistance has increased somewhere along the lines?
const int ledPinPlay = 13; // the pin that the LED for Play/pause is attached to
const int analogPinVol = 0; // the pin that the volume is attached to
const int ledCount = 6;
// Variables will change:
int ledPins[] = {
7, 9, 10, 11, 12, 13 }; // an array of pin numbers to which LEDs are attached
void setup() {
// loop over the pin array and set them all to output:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
}
}
void loop() {
// read the volume:
int sensorReading = analogRead(analogPinVol);
// map the result to a range from 0 to the number of LEDs:
int ledLevel = map(sensorReading, 120, 600, 0, ledCount);
// loop over the LED array:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
// if the array element's index is less than ledLevel,
// turn the pin for this element on:
if (thisLed < ledLevel) {
digitalWrite(ledPins[thisLed], HIGH);
}
// turn off all pins higher than the ledLevel:
else {
digitalWrite(ledPins[thisLed], LOW);
}
}
}
with this code in place with the analog volume sensor… the LEDs wont light up although theLED on the board, Pin 13, does light up as you move closer to the sensor (analogPinVol). Currently plugged into PC with USB
It is as though the board isnt getting enough current?