Hello and greetings from Finland. I have the UNO r3 and was going to just test flashing LED so I have try to troubleshoot this but maybe the board is broken then, as the L1 led flashes, the Arduino IDE program seems to upload the code properly, the LED does work when connected on other power source, and the Arduino is connected via USB all the time (to get power) so thats the only reason I figured out, do I need to power up the board from other source then?
Here is the simple code, which shouldnt at least be the issue (the LED is connected to ground and pin 9) as I try just to make it on not even flash it does not go on even with this:
int ledPin = 9; // Kytketty pinniin 9
void setup() {
pinMode(ledPin, OUTPUT); // Määritellään pinni 9 ulostuloksi
}
void loop() {
digitalWrite(ledPin, HIGH); // Sytytetään LED
}
Can you please post a copy of your circuit, a picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
That does not make sense. Why would resistor affect, Arduino would give current? And what comes to the pin "blown up" that should not be possible, as you can connect for example motor (motor will use more watt than LED and also, LED acts like a fuse and the LED will blow first, not the Arduino, and the LED is working perfectly with other power source and yes, I do know semiconductors contain the + and -) for what comes the circuit copy delivery, you must have understood the situation: I have pin 9 and ground, which are connected to the LED but nothing happens, when I press "Verify" and the program tells, the code has been uploaded into the Arduino. So guess I will next just try some other port, but it seems unlikely, they will work either so I think we gonna end to conclusion the board must be replaced.
NO. Port pin limited to 40 mA, above that survival not guaranteed. An LED with no resistor is effectively a short, whether to GND or to VCC.
It's a tossup whether the LED dies or the port pin dies, depending on which technology will tolerate less abuse in the manner you are abusing it.
Thanks for the pin mA info, didnt realize that. But nevertheless, the LED would have flashed even a short time, before the pin blow up, which it didnt. The reason why, I dont use resistors is, that when applying a mhz scale flashing and with the simulation of dutycycle, you can in fact use LED without resistor and even with higher voltages like 5 volts, without breaking them down.
// Määritellään pinni LEDille
int ledPin = 9;
void setup() {
// Asetetaan pinni 9 ulostuloksi
pinMode(ledPin, OUTPUT);
// Käynnistetään Timer1 ajastin 1 MHz taajuudella
setupTimer1(1000000); // 1 MHz taajuus
}
void loop() {
// Timer1 tekee itsenäisesti LEDin vilkutuksen, joten loop() on tyhjä
}
void setupTimer1(int frequency) {
// Timer1-asetukset, jotka mahdollistavat korkeat taajuudet
noInterrupts(); // Keskeytykset pois päältä
TCCR1A = 0; // Nollataan rekisterit
TCCR1B = 0;
// Lasketaan arvo OCR1A:lle (ajastimen vertailuarvo)
int compareMatch = (16e6 / (2 * frequency)) - 1; // Arduinon kellotaajuus 16 MHz
OCR1A = compareMatch; // Asetetaan vertailuarvo (ajastimen resoluutio)
TCCR1B |= (1 << WGM12); // CTC (Clear Timer on Compare Match) tila
TCCR1B |= (1 << CS10); // Kellotaajuus ilman esijakajaa
TIMSK1 |= (1 << OCIE1A); // Aktivoidaan keskeytys vertailuarvon kohdalla
interrupts(); // Keskeytykset takaisin päälle
}
// Tämä funktio hoitaa keskeytykset ja LEDin vilkutuksen
ISR(TIMER1_COMPA_vect) {
// Käännetään pinni 9 tila (ON/OFF)
digitalWrite(ledPin, !digitalRead(ledPin));
}
Please edit your post, select all code and click the <CODE/> button; next save your post. This will apply code tags to your code which will make it easier to read and easier to copy; the forum will also display it correctly.
int ledPin = 9; // Kytketty pinniin 9
void setup() {
pinMode(ledPin, OUTPUT); // Määritellään pinni 9 ulostuloksi
}
void loop() {
digitalWrite(ledPin, HIGH); // Sytytetään LED
}
This, of course, would not have flashed anything, at any frequency. Light it, yes, for as long as the pin output transistor survives.
As for not needing a resistor at high frequencies, I disagree, as it implies design arrogance. "my code is so perfect it will never leave the pin on, so I don't need to plan for that", isn't design, in my opinion. YMMV.
I am aware that code was not meant to flash anything, that code was made only to test if the arduino will even give current to the led, as the first code of flashing: didnt do anything. And, as I am doing photonics experiments, using resistors isnt option in this case.
Your application space may demand that, granted, but conditions are different when you apply a DC signal to an LED. What you did, what you said, what you presented, all point to an inappropriate usage that likely damaged your Arduino.
This is why we are/were concerned.
If your application demands that you pulse that LED with zero protection for Arduino or LED, then I would suggest your application would benefit from a hardware device designed to do that. Nothing more, nothing less. Arguing with us about applicability of our concerns, when we have no context for your application, is a waste of your time and ours.
I'm out. I think you may have gleaned an answer, if not, others can continue.
I agree that a series resistor should be included in order to not exceed the max safe current from the GPIO pin. Assuming (because you expect HIGH to turn it on) you have the anode connected to the GPIO pin (ideally through a series resistor) and the cathode connected to ground. I think the list of possible reasons why the LED isn't lighting up is:
There isn't 5V on the pin you have the LED connected to. Have you tried measuring that with a multimeter when the LED isn't connected?
The LED has blown, but I think you said it lights when powered from some other source, so this seems unlikely
There is something wrong with the connection to the LED. This could be checked with the multimeter in resistance mode. Check both: Anode connected to Arduino GPIO pin (0 Ohms, or value of series resistor if you included one), and Cathode connected to ground (0 Ohms).
The LED anode and cathode are the wrong way round. This could be checked by inspection, or trying it the other way round.
The arduino output pin failed when powered and LED was turned on. As others have pointed out, it's more likely the LED survived than the Arduino output. Fortunately, all the OP needs to do in that instance is change output pins, put in a resistor, and try again.
Yes. I indended point 1 to include that case. It would also cover the case where the LED not connected to the same GPIO pin that the code is turning on.
Oh well, the changing if the pin worked out then. I just didnt remember, as this is MICROcontroller and not for example, controller for stepper motor, it cant handle much power though it and actually, i have had experience of the issue before as I used REMOTE controllers (they have IR led which just is replaced with normal one) but as with the increased power drainage, the remote controller will eventually break down. I didnt just expect, that Arduino would break down in a nanosecond, as the led didnt even flash so fortunately, i dont need to replace the whole board: so even i made mistake, i learned two things: arduino is sensitive but arduino is also designed very good, as one pin breaks down it wont at least this kind of issue, break down whole arduino.
thx for all the support anyways, what a great forum as usually people are not so eager to help or at least, be kind.
if you interested on the setupt with flashing leds with remote controllers and stepper motor controller, its quite fascinating in the aspect that it will affect photosynthesis in a positive way + modern quantum physic has also learned, in plant cell with photosynthesis, also happens quantum operations which was very surprising, to find those phenomenom also inside plant cell.
the hz is about 3k here, i measured it by just simple attaching the remote controller to audio in at soundcard, then zoom the signal with goldwave.