I´m trying to insert a binary raw sequence (01010100, 01101000, 01100001)
into Arduino. I would like to make 8-led group blink in a loop, showing with light each 8-group binary sequence when: 0=light off
and 1=light on
.
It´s possible to do this operation with Arduino-Uno?
Basically you could do something like:
int myPins[] = {2, 3, 4, 5, 6, 7, 8, 9};
byte sequence[] = {B01001001,B00000001,B00000011};
void setup(){
for(int i = 0; i < 8; i++){
pinMode(myPins[i], OUTPUT);
}
}
void loop(){
for(int i = 0; i < 3; i++){
turnOnOff(sequence[i]);
delay(500); //just to see results
}
}
void turnOnOff(byte data){
for(int i = 0; i < 8; i++){
boolean onOff = data & (B00000001 << i);
digitalWrite(myPins[i],onOff);
}
}