Hello all,
Im new in this forum. I am trying to use a nano to create 8 bits value with 1 bit increment. However, I only managed to get 6 bits working with the code below:
void setup()
{
//Using only 6 bits (A0~A5) as PORTC maps to Arduino analog pins
//0 to 5. Pins 6 & 7 are only accessible on the Arduino Mini
DDRC = DDRC | B111111; // set PORTC (Analog pins 5~0) to outputs
// Digital 2~7 set to outputs
delay(timer);
PORTC = B000000;
}
void loop()
{
//Increment the 6 bits by 1 bit
PORTC = PORTC + B000001;
}
Even using DDRD = DDRD | B11111111; // set PORTD (Digital pins 7~0) to outputs only the 6 first bits work.
I need all 8 bits.
Any idea how I can program 8 pins on the Nano to act as a single bank so I can increment by 1 bit up to 11111111 please?
Thanks