Created
February 7, 2014 19:22
-
-
Save pingswept/8869896 to your computer and use it in GitHub Desktop.
Test code for the 4x4 driver shield. Pulses all 16 outputs on and off with a 1 second delay in between.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void setup() { | |
| //set pins to output because they are addressed in the main loop | |
| pinMode(7, OUTPUT); | |
| pinMode(8, OUTPUT); | |
| pinMode(11, OUTPUT); | |
| pinMode(13, OUTPUT); | |
| } | |
| void loop() { | |
| // put your main code here, to run repeatedly: | |
| int data = 0xFF; | |
| digitalWrite(7, LOW); // Prepares latch | |
| digitalWrite(8, HIGH); // Deactivates master reset | |
| shiftOut(11, 13, MSBFIRST, (0xFF)); // shift data for OUT8-OUT15 | |
| shiftOut(11, 13, MSBFIRST, 0xFF); // shift data for OUT0-OUT7 | |
| digitalWrite(7, HIGH); | |
| delay(1000); | |
| // REPEAT WITH INVERSE | |
| data = 0x00; | |
| digitalWrite(7, LOW); // Prepares latch | |
| digitalWrite(8, HIGH); // Deactivates master reset | |
| shiftOut(11, 13, MSBFIRST, (0x00)); // shift data for OUT8-OUT15 | |
| shiftOut(11, 13, MSBFIRST, 0x00); // shift data for OUT0-OUT7 | |
| digitalWrite(7, HIGH); | |
| delay(1000); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment