shift register acting funny
hi i'm rather new @ arduino thing. have not quite figured out of fixes. have been fiddling shift register though & first time put circuit code project worked beautifully, dis-assemblyed & tried again & reason, works shift register working in inverse! 1's 0's & 0's 1's.
/*
name: binary counter (led on = 1, led off = 0)
notes: shift register - 74hc595
*/
//control pins shift register.
int l_pin=8; //latch pin - connected st_cp.
int c_pin=12; //clock pin - connected sh_cp.
int d_pin=11; //data pin - connected ds.
void setup(){
//set control pins output.
pinmode(l_pin,output);
pinmode(c_pin,output);
pinmode(d_pin,output);
}
void loop(){
for(int binno=0; binno<256; binno++){
digitalwrite(l_pin,low); //l_pin=0 - led's remain const upload.
shiftout(d_pin, c_pin, msbfirst, binno); //shift out byte.
//msbfirst - significant bit first
digitalwrite(l_pin,high); //l_pin=1 - led's change upload.
delay(100); //pause next val.
}
}
/*
name: binary counter (led on = 1, led off = 0)
notes: shift register - 74hc595
*/
//control pins shift register.
int l_pin=8; //latch pin - connected st_cp.
int c_pin=12; //clock pin - connected sh_cp.
int d_pin=11; //data pin - connected ds.
void setup(){
//set control pins output.
pinmode(l_pin,output);
pinmode(c_pin,output);
pinmode(d_pin,output);
}
void loop(){
for(int binno=0; binno<256; binno++){
digitalwrite(l_pin,low); //l_pin=0 - led's remain const upload.
shiftout(d_pin, c_pin, msbfirst, binno); //shift out byte.
//msbfirst - significant bit first
digitalwrite(l_pin,high); //l_pin=1 - led's change upload.
delay(100); //pause next val.
}
}
Arduino Forum > General Category > General Discussion (Moderators: mbanzi, DojoDave, mellis) > shift register acting funny
arduino
Comments
Post a Comment