Looping program for 4794 shiftout controller
hey everybody,
i'm trying sequence shiftout controller each led come off sequentially 1 after another.
i've managed sequence down far have been unable program loop.
i'm thinking i'm using wrong type of loop (maybe if clause instead of for). if give me suggestions i'd appreciate it!
thanks.
(the code based on shiftout program in examples)
int data = 9;
int strob = 8;
int clock = 10;
int oe = 11;
int count = 0;
int dato[8] = {1,2,4,8,16,32,64,128}; // dato varible use send data leds
void setup()
{
//serial.begin(9600); // uncomment serial-related lines monitor program's progress
pinmode(data, output); // declare control pins outputs
pinmode(clock, output);
pinmode(strob, output);
pinmode(oe, output);
}
// sends pulse 4794 indicating that
// time load data
void pulseclock(void) {
digitalwrite(clock, low);
delaymicroseconds(10);
digitalwrite(clock, high);
delaymicroseconds(100);
digitalwrite(clock, low);
}
void loop()
{
//dato = 64; // if dato equals 129 first , last led on
// go through "dato" variable , send bit bit on data pin
for (int = 0; < 1000; i++)
{
for (count = 0; count < 8; count++) {
digitalwrite(data, dato[count] & 01);
//serial.print((dato & 01) + 48, byte);
dato[count]>>=1;
if (count == 7){
digitalwrite(oe, low);
digitalwrite(strob, high);
}
pulseclock();
digitalwrite(oe, high);
}
delaymicroseconds(20);
digitalwrite(oe, high);
digitalwrite(strob, low);
delay(200);
//serial.println();
delay(200); // waits second
count = 0;
}
}
i'm trying sequence shiftout controller each led come off sequentially 1 after another.
i've managed sequence down far have been unable program loop.
i'm thinking i'm using wrong type of loop (maybe if clause instead of for). if give me suggestions i'd appreciate it!
thanks.
(the code based on shiftout program in examples)
int data = 9;
int strob = 8;
int clock = 10;
int oe = 11;
int count = 0;
int dato[8] = {1,2,4,8,16,32,64,128}; // dato varible use send data leds
void setup()
{
//serial.begin(9600); // uncomment serial-related lines monitor program's progress
pinmode(data, output); // declare control pins outputs
pinmode(clock, output);
pinmode(strob, output);
pinmode(oe, output);
}
// sends pulse 4794 indicating that
// time load data
void pulseclock(void) {
digitalwrite(clock, low);
delaymicroseconds(10);
digitalwrite(clock, high);
delaymicroseconds(100);
digitalwrite(clock, low);
}
void loop()
{
//dato = 64; // if dato equals 129 first , last led on
// go through "dato" variable , send bit bit on data pin
for (int = 0; < 1000; i++)
{
for (count = 0; count < 8; count++) {
digitalwrite(data, dato[count] & 01);
//serial.print((dato & 01) + 48, byte);
dato[count]>>=1;
if (count == 7){
digitalwrite(oe, low);
digitalwrite(strob, high);
}
pulseclock();
digitalwrite(oe, high);
}
delaymicroseconds(20);
digitalwrite(oe, high);
digitalwrite(strob, low);
delay(200);
//serial.println();
delay(200); // waits second
count = 0;
}
}
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Looping program for 4794 shiftout controller
arduino
Comments
Post a Comment