daily pastebin goal
82%
SHARE
TWEET

Untitled

weinerm21 Jun 13th, 2018 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const int SER = 3;
  2. const int LATCH = 5;
  3. const int CLK = 4;
  4. int LedVals[9] = {0,1,2,4,8,16,32,64,128);
  5. int BacklLedVals[9] = {128,64,32,16,8,4,2,1,0};
  6. void setup()
  7. {
  8.   // put your setup code here, to run once:
  9. pinMode(SER, OUTPUT);
  10. pinMode(LATCH, OUTPUT);
  11. pinMode(CLK, OUTPUT);
  12. digitalWrite(LATCH, LOW);
  13. shiftOut(SER, CLK, MSBFIRST, B11111111);
  14. digitalWrite(LATCH, HIGH);
  15. delay(200);
  16. digitalWrite(LATCH, LOW);
  17. shiftOut(SER, CLK, MSBFIRST, B00000000;
  18. digitalWrite(LATCH, HIGH);
  19. }
  20.  
  21. void loop()
  22. {
  23.   // put your main code here, to run repeatedly:
  24. for(int i=0; i<8; i++)
  25. {
  26.   digitalWrite(LATCH, LOW);
  27.   shiftOut(SER, CLK, MSBFIRST, LedVals[i]);
  28.   digitalWrite(LATCH, HIGH);
  29.   delay (200);
  30. }
  31. for(int i=0; i<8; i++)
  32. {
  33.   digitalWrite(LATCH, LOW);
  34.   shiftOut(SER, CLK, MSBFIRST, BackLedVals[i]);
  35.   digitalWrite(LATCH, HIGH);
  36.   delay (200);
  37. }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top