8 blinking leds

i am trying to make program of 8 blinking using port manipulation technique. I have used port B pin (6-13). I am getting an error quoted " DDRB was not declared in this scope". I have attached the image. If any one can help me out with it, it would be great help :slight_smile:

void setup() {
  // put your setup code here, to run once:
DDRB = DDRB| B111111;
}
void loop() {
  // put your main code here, to run repeatedly:
PORTB = B111111;// turn the LED on (HIGH is the voltage level)  
  delay(1000); // wait for a second

PORTB = B000000;    // turn the LED off by making the voltage LOW
 delay(1000);              // wait for a second

}

I see that you are compiling the code for a Due. Does it have the same ports as the 328 based boards ?

Yes, I have been using Due. And no, it has more number of ports than 328 based boards. Can you help me out with it??

The Due is a different processor (ARM-based) to the 328 boards (AVR) - you cannot simply use the same port manipulation registers.

Then what should be I doing if I don't want to increase my code lines and still control all the pins using less function?

If I were that desperate, I'd be picking apart "wiring_digital.c" and "wiring_digital.h" in "sam/cores/arduino"

I'm not that desperate.

shreerajshah95:
Then what should be I doing if I don't want to increase my code lines and still control all the pins using less function?

How important is it that the LEDs turn on and off at exactly the same time ?

It is very important for led's to blink at the exact time as expected. Is there any alternative for it in 'Arduino Due' other than the code i wrote??

UKHeliBob:
How important is it that the LEDs turn on and off at exactly the same time ?

It is very important for led's to blink at the exact time as expected

What is it that reacts to the blinking of the LEDs ?

Why not just use one output, digitalWrite() and 8 transistors to turn on the LEDs or output a byte with a value of 255 to a shift register and do it that way ?