/* DirectPort_Manipulation.ino
/*
/* Using registers to manipulation port output
/* to control LEDs
/* by : Helena Liuw
*/
// #include <LiquidCrystal_I2C.h>
void setup(){
Serial.begin(9600);
DDRB = B00111111; // set pinMode for pin 8-13 to OUTPUT
}
void loop(){
PORTB = B00000000; // set to LOW
// set 1 to a bit of the PINx register
// will toggle it's output
delay(1000);
PORTB |= B00000001;
Serial.println("TES");
delay(1000);
PINB = B00000001;
delay(1000);
PORTB = B00000001;
delay(500);
Serial.println(PORTB);
for(int i=1;i<=4;i++){
PINB = PINB << 1;
Serial.println(PORTB);
delay(500);
}
// delay(500);
// PINB = B00000010;
// delay(500);
// PINB = B00000100;
// delay(500);
// PINB = B00001000;
// delay(500);
// PINB = B00010000;
// delay(500);
// PINB = B00100000;
// delay(500);
// PINB = B00111111; // all off
// delay(500);
// PINB = B00100000;
// delay(500);
// PINB = B00010000;
// delay(500);
// PINB = B00001000;
// delay(500);
// PINB = B00000100;
// delay(500);
// PINB = B00000010;
// delay(500);
// PINB = B00000001;
// delay(500);
// Blinking LEDs 3 times
// for (int i=0;i<3;i++){
// PORTB = B00000111;
// delay(200);
// PORTB = B00000000;
// delay(200);
// }
// delay(500);
// PORTB = B00000111;
// delay(500);
// PORTB = B00000000;
// PORTB |= B00000100;
// delay(500);
// PORTB = B00000000;
// PORTB |= B00000010;
// delay(500);
// PORTB = B00000000;
// PORTB |= B00000001;
// delay(500);
// PORTB = B00000000;
// delay(500);
// PORTB = B00000111;
// delay(500);
// PORTB &= B00000011;
// delay(500);
// PORTB &= B00000001;
// delay(500);
// PORTB &= B00000000;
// delay(500);
}