const int A = 1;
int i = 1000;
bool plusorminus = true;
void setup() {
pinMode(A, OUTPUT);
}
void loop() {
if(plusorminus == true) i = i - 100;
else i = i + 100;
digitalWrite(A, HIGH);
delay(i);
digitalWrite(A, LOW);
delay(i);
if(plusorminus == true && i == 0) plusorminus = false;
else if(plusorminus == false && i == 1000) plusorminus = true;
}
Now, I want to blink my LED on a different PIN. How is the configuration of the PINs on this board? I can't figure it out. When I use for example A = 4 (PIN 4), then I can't find the PIN on the board to blink my LED.
This is my first problem.
My second is, that I own the book "Make: AVR Programming". There is a code sample like this:
When I use for example A = 4 (PIN 4), then I can't find the PIN on the board to blink my LED.
Could it be the digital pin cunningly labelled D4, do you think ?
The pin numbers printed on the board do not relate directly to the pin numbers of the AVR chip. They are automatically translated as part of the compilation process
No, it isn't. When I try to plug the LED to PIN D4, then it doesn't blink.
Are you saying that if you set A = 4 in the first sketch of your original post and connect an LED (and resistor, of course) to D4 that the LED does not blink ?
What happens if you set A = LED_BUILTIN ?
Does the built in LED on pin 13 blink ?
UKHeliBob:
Are you saying that if you set A = 4 in the first sketch of your original post and connect an LED (and resistor, of course) to D4 that the LED does not blink ?
What happens if you set A = LED_BUILTIN ?
Does the built in LED on pin 13 blink ?
Hm. I've got two boards and yes, it looks like it is defect.
Are there any advices to NOT destroy the board? (I'm a newbie)
Well, the only thing what I did is to try every pin. So i connected my LED step by step to every pin. But I think it wasn't a good idea. How can I prevent this?