Devices & Components
Arduino Uno Rev3
Power Adapter - 12VAC, 500ma Output
Project description
Code
Say Hello
cpp
Example sketch for Experimental Shield
1/* 2 Experimental Shield Displays "HELLO" - Arduino UNO - - - - L. Thomas - December 2023 3 4*/ 5// The 7 lines below give names to the UNO pins 3, 8, 9, 10, 11, 12, and 13 6int GrnLED = 3; // pin 3 is connected to the GREEN LED 7int RedLED = 13; // pin 13 is connected to the RED LED 8int DataIn = 8; // pin 8 is serial in data for the shift register 9int ClkIn = 9; // pin 9 clocks in the data from pin 8 10int RegClk = 10; // pin 10 clocks byte of data to the outputs 11int OutEnable = 11; // pin 11, when LOW, enables the output (HIGH disables) 12int Clear = 12; // pin 12, when LOW, clears the shift register to all zeros 13// 14byte LtrH = 118; // Value that will display an H 15byte LtrE = 121; // Value that will display an E 16byte LtrL = 56; // Value that will display an L 17byte LtrO = 63; // Value that will display an O (or zero) 18// 19// The setup routine runs once during start-up or when RESET is pressed. 20// The setup commands are inside the pair of curly braces following "void setup()" 21void setup() 22{ 23 pinMode(GrnLED, OUTPUT); // This sets pin 3 as an output 24 pinMode(RedLED, OUTPUT); // This sets pin 13 as an output 25 pinMode(DataIn, OUTPUT); // This sets pin 8 as an output 26 pinMode(ClkIn, OUTPUT); // This sets pin 9 as an output 27 pinMode(RegClk, OUTPUT); // This sets pin 10 as an output 28 pinMode(OutEnable, OUTPUT); // This sets pin 11 as an output 29 pinMode(Clear, OUTPUT); // This sets pin 12 as an output 30// 31 digitalWrite(RedLED, LOW); // This turns off the RED LED 32 digitalWrite(GrnLED, LOW); // This turns off the GREEN LED 33 digitalWrite(DataIn, LOW); // Make data pin a zero (LOW) 34 digitalWrite(ClkIn, LOW); // Initialize the input clock to LOW status 35 digitalWrite(RegClk, LOW); // Shift register clock initialized LOW 36 digitalWrite(OutEnable, LOW); // Shift register output is enabled 37 digitalWrite(Clear, HIGH); // Initialize the CLEAR pin to HIGH (not cleared) 38} 39// Now that the setup has been done, the main loop is started 40// **** MAIN LOOP *************************************************************** 41void loop () 42{ 43 shiftOut(DataIn, ClkIn, LSBFIRST, LtrH); //This loads an H into the shift register 44 DisplayON(); //Display it 45 shiftOut(DataIn, ClkIn, LSBFIRST, LtrE); //This loads an E into the shift register 46 DisplayON(); //Display it 47 shiftOut(DataIn, ClkIn, LSBFIRST, LtrL); //This loads an L into the shift register 48 DisplayON(); //Display it 49 shiftOut(DataIn, ClkIn, LSBFIRST, LtrL); //This loads an L into the shift register 50 DisplayON(); //Display it 51 shiftOut(DataIn, ClkIn, LSBFIRST, LtrO); //This loads an O into the shift register 52 DisplayON(); //Display it 53 digitalWrite(GrnLED, LOW); //Turn off the green LED 54 digitalWrite(RedLED, HIGH); //Turn on the red LED 55 delay(2000); //Pause 2 seconds before repeating 56 digitalWrite(RedLED, LOW); //Turn off the red LED 57 digitalWrite(GrnLED, HIGH); //Turn on the green LED -- End of the Loop 58} 59void DisplayON() //This function activates the display 60{ 61 digitalWrite(RegClk, HIGH); //Clock the data to the output register 62 digitalWrite(RegClk, LOW); //Put Clock signal back low 63 digitalWrite(OutEnable, LOW); //Enable the outputs to drive the segments 64 delay(300); //Give some time to see the result 65 digitalWrite(OutEnable, HIGH); //Disable the outputs (Turn off the display) 66 delay(40); //Leave it off briefly 67 digitalWrite(ClkIn, LOW); //Be sure clock is initialized to LOW status 68}
Downloadable files
General Information
General information, Schematic, Programming Notes
Experimental Shield_Info.pdf
Documentation
Programming Notes, Schematic, Display Worksheet
Technical Information
Experimental Shield-Tech.pdf
Full-Test Sketch (text file)
Allows functional verification of all features.
Full-Test.txt
Parts List
Full parts list and suggested sources.
Experimental Shield-parts list.pdf
Comments
Only logged in users can leave comments