Hello,
I have a basic issue that I want to understand.
To light the onboard LED (pin13) on Arduino duamilanovae, the example code is:
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(1000); // wait for a second
}
If I look at the source of the pinMode(), it seems to refer to "_BV( 7 ) , // PB 7 ** 13 ** PWM13" in "PROGMEM digital_pin_to_bit_mask_PGM[]".
It says so even at "http://urbanhonking.com/ideasfordozens/2009/05/18/an_tour_of_the_arduino_interna/"
I did the following, and got the LED to flash. So, it should be PB5 not PB7 as above - right?
void setup ()
{
DDRB = B00100000; // PB7 ..... PB0, Pin 13 (Ard) is connected to PB5 (Mega)
}
void loop ()
{
PORTB = B00100000;
delay (800);
PORTB = 0x0;
delay (800);
}
I would rather ask a stupid question than carry on without understanding properly.
Thanks for the help.