#define delay_ 100000
void setup() {
// put your setup code here, to run once:
volatile char *dir; // declared the direction of the data to the port, whether input(0) or output(1).
dir = 0x2a; // this is the port address for the direction (Port D Data Direction Register).
*dir = 0xff; //setiing all 8 pins on this port to output (hex:ff >> bin:1111 1111).
}
void loop() {
// put your main code here, to run repeatedly:
volatile char *out; // declared the output port.
out = 0x2b; // this is the port address for the data.
*out = 0x01; // this is the data sent to the port. (hex:55 >> bin:0101 0101) pin 7 will be high and the rest low.
for(int i = 0; i < 8; i++)
{
*out = (*out << 1);
for(volatile long i = 0; i < delay_; i++); //delay
}
}