I started learning Arduino recently so that I could complete my Senior Project in my Mechanical Design Degree (yeah, my professor said the same thing...)
Thus far, I have most of the code figured out, and I even have the 7 segment working using a tutorial from buildr but the code just seems really long and when i put all the code together to finish my project, i think it will be excessive.
So is there a way to Shift in all 8 bits into the register (595) without using 8 lines of code?
my current code looks something like this:
if (number == 0) {
//0
setRegisterPin(0, 0);
setRegisterPin(1, 0);
setRegisterPin(2, 0);
setRegisterPin(3, 1);
setRegisterPin(4, 0);
setRegisterPin(5, 0);
setRegisterPin(6, 0);
setRegisterPin(7, HIGH);
writeRegisters();
The code that I am interested in using uses the ShiftOut command:
shiftOut(data, clock, LSBFIRST, zero);
byte c = B01100000;
byte d = 0b01100000;
void setup(){
Serial.begin(9600);
Serial.println(c);
Serial.println(d);
}
void loop(){
}
Apparently both work fine. Only difference (looking at the screen only !) is that the word B01100000 is automatically displayed in blue while the word 0b01100000 is displayed in black as normal text.