Shift register 74HC595-switching 2LED at the same
looking sample code found in tutorial section (http://www.arduino.cc/en/tutorial/shiftout) can switch "on" leds 1 one using second example. in specific case want light example led3 , led7 need switch between led3 , led7 reduces lumen output @ least 50%, correct?
how code have cases described above, switchin on 2 or 3 leds same time?
how code have cases described above, switchin on 2 or 3 leds same time?
the simplest code want, given definitions , setup() in example
probably wise use procedure set value:
and call like
code: [select]
// turn off output pins don't light up
// while you're shifting bits:
digitalwrite(latchpin, low);
// shift bits out: 0b10001000 sets pins 3 , 7
shiftout(datapin, clockpin, msbfirst, 0b10001000);
// turn on output leds can light up:
digitalwrite(latchpin, high);
probably wise use procedure set value:
code: [select]
void setbits(int val) {
// turn off output pins don't light up
// while you're shifting bits:
digitalwrite(latchpin, low);
// shift bits out:
shiftout(datapin, clockpin, msbfirst, val);
// turn on output leds can light up:
digitalwrite(latchpin, high);
}and call like
code: [select]
setbits(0b10001000);
Arduino Forum > Forum 2005-2010 (read only) > Software > Interfacing > Shift register 74HC595-switching 2LED at the same
arduino
Comments
Post a Comment