Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- */
- // set up a variable for the switch case
- byte var = 1; setup and per loads 1 because I never wanted to be equal to zero
- // the setup function runs once when you press reset or power the board
- void setup() {
- //next part is to set up and declare all the pins and tell you what they're attached to
- pinMode(13, OUTPUT); // clk pin
- pinMode(11, OUTPUT); // data pin
- pinMode(2, OUTPUT); // on the negative cathode of 16 sagmint one
- pinMode(3, OUTPUT); // on the negative cathode of 16 sagmint two
- pinMode(4, OUTPUT); // on the negative cathode of 16 sagmint 3
- pinMode(5, OUTPUT); // on the negative cathode of 16 sagmint 4
- pinMode(6, OUTPUT); // on the negative cathode of 16 sagmint 5
- pinMode(7, OUTPUT); // 16 sagmint 6
- // this is to set the clk to low if you don't do this it takes a shit
- digitalWrite(13, LOW); // this has to be here for the 74164
- }
- // the loop function runs over and over again forever
- void loop() {
- // this parts to run the switch case
- var++;
- if (var == 7){
- var = 1;
- }
- switch (var) {
- case 1: // this loads the 47164s with data
- shiftOut(11, 13, LSBFIRST, B11110000);
- shiftOut(11, 13, LSBFIRST, B00000000);
- // this sets wich 16 sag to use
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- digitalWrite(5, HIGH);
- digitalWrite(6, HIGH);
- digitalWrite(7, LOW);
- break;
- case 2:
- shiftOut(11, 13, LSBFIRST, B11111111);
- shiftOut(11, 13, LSBFIRST, B00000000);
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- digitalWrite(5, HIGH);
- digitalWrite(6, LOW);
- digitalWrite(7, HIGH);
- break;
- case 3:
- shiftOut(11, 13, LSBFIRST, B00001100);
- shiftOut(11, 13, LSBFIRST, B00010001);
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- digitalWrite(5, LOW);
- digitalWrite(6, HIGH);
- digitalWrite(7, HIGH);
- break;
- case 4:
- shiftOut(11, 13, LSBFIRST, B11100001);
- shiftOut(11, 13, LSBFIRST, B10000000);
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, LOW);
- digitalWrite(5, HIGH);
- digitalWrite(6, HIGH);
- digitalWrite(7, HIGH);
- break;
- case 5:
- shiftOut(11, 13, LSBFIRST, B00000000);
- shiftOut(11, 13, LSBFIRST, B00000000);
- digitalWrite(2, HIGH);
- digitalWrite(3, LOW);
- digitalWrite(4, HIGH);
- digitalWrite(5, HIGH);
- digitalWrite(6, HIGH);
- digitalWrite(7, HIGH);
- break;
- case 6:
- shiftOut(11, 13, LSBFIRST, B11111100);
- shiftOut(11, 13, LSBFIRST, B00000000);
- digitalWrite(2, LOW);
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- digitalWrite(5, HIGH);
- digitalWrite(6, HIGH);
- digitalWrite(7, HIGH);
- break;
- default:
- break;
- }
- digitalWrite(2, HIGH);
- digitalWrite(3, HIGH);
- digitalWrite(4, HIGH);
- digitalWrite(5, HIGH);
- digitalWrite(6, HIGH);
- digitalWrite(7, HIGH);
- shiftOut(11, 13, LSBFIRST, B00000000);
- shiftOut(11, 13, LSBFIRST, B00000000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement