Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino source code for KC868-A256]-04 OUTPUT_256
#1
Code:
/*
KC868-256  press button S2,all leds will on one by one;
            release the button,all leds will off one by one;
*/

int latchPin = 4;
int clockPin = 16;
int dataPin = 5;
int button =0;

void setup()
{
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT); 
  pinMode(clockPin, OUTPUT);
  pinMode(button, INPUT);
 
}

void loop()
{
if(digitalRead(button)==LOW){
     
     digitalWrite(dataPin,HIGH);
     delay(10);
     digitalWrite(clockPin,LOW);
     delay(10);
     digitalWrite(clockPin,HIGH);
     delay(10);
     digitalWrite(latchPin, LOW);
     delay(10);
     digitalWrite(latchPin, HIGH);
     delay(100);
}
else {
     digitalWrite(dataPin,LOW);
     delay(10);
     digitalWrite(clockPin,LOW);
     delay(10);
     digitalWrite(clockPin,HIGH);
     delay(10);
     digitalWrite(latchPin, LOW);
     delay(10);
     digitalWrite(latchPin, HIGH);
     delay(100);
  }

}


Attached Files
.zip   A256-output_256.zip (Size: 635 bytes / Downloads: 299)
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)