SlideShare ist ein Scribd-Unternehmen logo
1 von 15
ARDUINO FINAL
PROJECT
MAIN PROJECT
To make a temperature sensor that outputs the
reading as a scrolling message on a LED
matrix.
We used a LED matrix which is a common anode
8x8 display.
Wired on breadboards.
MAIN CONCEPT
Use of two shift registers (2x 74HC595) to pass the encoded-
charachter data serially from the arduino as a parallel output to
the rows and Columns of an 8x8 LED matrix.
The arduino handles the scrolling of the message and the periodic
time-multiplexing of rows and columns (refresh rate = 100Hz),
using a periodic interrupt, to which the function “screenUpdate”
is attached.
So , we calibrated the sensor using a potentiometer through the
serial monitor window.
then the complete circuit is connected.
WIRING DIAGRAM
74HC595-SHIFT
REGISTERS
-- An 8-bit shift register with
Serial to parallel capability.
-- We use two of them,
Each one controlling eight
rows/columns.
LM335-TEMPERATURE SENSOR
Calibration:
-- We connect the calibration circuit , and
connected it’s output as an analogue input
to the arduino.
-- With a potentiometer, and a small
code... we used the serial monitor of
arduino to
fine-tune the sensor to give an
acceptable reading (28°C for average
room temperature).
CODE#include <TimerOne.h>
#include <charEncodings.h> // Each charachter and it’s (8x8 LED matrix)-mapped code.
// BASIC PIN CONFIGURATION
// AND DECLARATIONS
//Pin connected to Pin 12 of 74HC595 (Latch)
int latchPin = 8;
//Pin connected to Pin 11 of 74HC595 (Clock)
int clockPin = 12;
//Pin connected to Pin 14 of 74HC595 (Data)
int dataPin = 11;
// pin for the potentiometer to control the scrolling speed
int potPin = 5;
// pin for reading the temperature
int tempPin = 4;
// this is the gobal array that represents what the matrix
// is currently displaying
uint8_t led[8];
CODE
void setup()
{
//set pins to output
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
pinMode(potPin, INPUT);
pinMode(tempPin, INPUT);
analogReference(INTERNAL);
// attach the screenUpdate function to the interrupt timer
// Period=10,000micro-second /refresh rate =100Hz
Timer1.initialize(10000);
Timer1.attachInterrupt(screenUpdate);
}
CODE
//Continuous LOOP
void loop()
{
long counter1 = 0;
long counter2 = 0;
char reading[10];
char buffer[18];
if (counter1++ >=100000) {
counter2++;
}
if (counter2 >= 10000) {
counter1 = 0;
counter2 = 0;
}
getTemp(reading);
displayScrolledText(reading);
}
THE (DISPLAYSCROLLEDTEXT )
FUNCTION
void displayScrolledText(char* textToDisplay)
{
int textLen = strlen(textToDisplay);
char charLeft, charRight;
// scan through entire string one column at a time and call
// function to display 8 columns to the right
for (int col = 1; col <= textLen*8; col++)
{
// if (col-1) is exact multiple of 8 then only one character
// involved, so just display that one
if ((col-1) % 8 == 0 )
{
char charToDisplay = textToDisplay[(col-1)/8];
for (int j=0; j<8; j++)
{
led[j] = charBitmaps[charToDisplay][j];
}
}
else
{
int charLeftIndex = (col-1)/8;
int charRightIndex = (col-1)/8+1;
charLeft = textToDisplay[charLeftIndex];
// check we are not off the end of the string
if (charRightIndex <= textLen)
{
charRight = textToDisplay[charRightIndex];
}
else
{
charRight = ' ';
}
setMatrixFromPosition(charLeft, charRight, (col-1) % 8);
}
int delayTime = analogRead(potPin);
delay (delayTime);
}
}
void shiftIt(byte dataOut) {
// Shift out 8 bits LSB first,
// on rising edge of clock
boolean pinState;
//clear shift register read for sending data
digitalWrite(dataPin, LOW);
// for each bit in dataOut send out a bit
for (int i=0; i<=7; i++) {
//set clockPin to LOW prior to sending bit
digitalWrite(clockPin, LOW);
// if the value of DataOut and (logical AND) a bitmask
// are true, set pinState to 1 (HIGH)
if ( dataOut & (1<<i) ) {
pinState = HIGH;
}
else {
pinState = LOW;
}
//sets dataPin to HIGH or LOW depending on pinState
digitalWrite(dataPin, pinState);
//send bit out on rising edge of clock
digitalWrite(clockPin, HIGH);
digitalWrite(dataPin, LOW);
}
//stop shifting
digitalWrite(clockPin, LOW);
}
boolean isKeyboardInput() {
// returns true is there is any characters in the keyboard buffer
return (Serial.available() > 0);
}
}
// terminate the string
readString[index] = '0';
}
void setMatrixFromPosition(char charLeft, char charRight, int col) {
// take col left most columns from left character and bitwise OR with 8-col from
// the right character
for (int j=0; j<8; j++) {
led[j] = charBitmaps[charLeft][j] << col | charBitmaps[charRight][j] >> 8-col;
}
}
void screenUpdate() {
uint8_t col = B00000001;
for (byte k = 0; k < 8; k++) {
digitalWrite(latchPin, LOW); // Open up the latch ready to receive data
shiftIt(~led[7-k]);
shiftIt(col);
digitalWrite(latchPin, HIGH); // Close the latch, sending the registers data to the matrix
col = col << 1;
}
digitalWrite(latchPin, LOW);
shiftIt(~0 );
shiftIt(255);
digitalWrite(latchPin, HIGH);
}
void getTemp(char* reading) {
int span = 20;
int aRead = 0;
long temp;
char tmpStr[10];
// average out several readings
for (int i = 0; i < span; i++) {
aRead = aRead+analogRead(tempPin);
}
aRead = aRead / span;
temp = ((100*1.1*aRead)/1024)*10;
reading[0] = '0';
itoa(temp/10, tmpStr, 10);
strcat(reading,tmpStr);
strcat(reading, ".");
itoa(temp % 10, tmpStr, 10);
strcat(reading, tmpStr);
strcat(reading, "C");
}

Weitere ähnliche Inhalte

Was ist angesagt?

Input Output programming in AVR microcontroller
Input  Output  programming in AVR microcontrollerInput  Output  programming in AVR microcontroller
Input Output programming in AVR microcontrollerRobo India
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesRicardo Castro
 
The IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IOT Academy
 
14827 shift registers
14827 shift registers14827 shift registers
14827 shift registersSandeep Kumar
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersCorrado Santoro
 
8 bit single cycle processor
8 bit single cycle processor8 bit single cycle processor
8 bit single cycle processorDhaval Kaneria
 
Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現Ron Liu
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentationarushi bhatnagar
 
Digital logic design DLD Logic gates
Digital logic design DLD Logic gatesDigital logic design DLD Logic gates
Digital logic design DLD Logic gatesSalman Khan
 
Digital logic design lecture 04
Digital logic design   lecture 04 Digital logic design   lecture 04
Digital logic design lecture 04 FarhatUllah27
 

Was ist angesagt? (20)

Unix signals
Unix signalsUnix signals
Unix signals
 
Input Output programming in AVR microcontroller
Input  Output  programming in AVR microcontrollerInput  Output  programming in AVR microcontroller
Input Output programming in AVR microcontroller
 
Experiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gatesExperiment write-vhdl-code-for-realize-all-logic-gates
Experiment write-vhdl-code-for-realize-all-logic-gates
 
Alu description[1]
Alu description[1]Alu description[1]
Alu description[1]
 
Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31Arduino Workshop 2011.05.31
Arduino Workshop 2011.05.31
 
The IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programming
 
14827 shift registers
14827 shift registers14827 shift registers
14827 shift registers
 
Uart
UartUart
Uart
 
Using Timers in PIC18F Microcontrollers
Using Timers in PIC18F MicrocontrollersUsing Timers in PIC18F Microcontrollers
Using Timers in PIC18F Microcontrollers
 
FPGA Tutorial - LCD Interface
FPGA Tutorial - LCD InterfaceFPGA Tutorial - LCD Interface
FPGA Tutorial - LCD Interface
 
Registers siso, sipo
Registers siso, sipoRegisters siso, sipo
Registers siso, sipo
 
8 bit single cycle processor
8 bit single cycle processor8 bit single cycle processor
8 bit single cycle processor
 
Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現Day4 順序控制的循序邏輯實現
Day4 順序控制的循序邏輯實現
 
New microsoft office power point presentation
New microsoft office power point presentationNew microsoft office power point presentation
New microsoft office power point presentation
 
Pir code
Pir codePir code
Pir code
 
Digital logic design DLD Logic gates
Digital logic design DLD Logic gatesDigital logic design DLD Logic gates
Digital logic design DLD Logic gates
 
Shift register
Shift registerShift register
Shift register
 
Digital logic design lecture 04
Digital logic design   lecture 04 Digital logic design   lecture 04
Digital logic design lecture 04
 
Logic gate
Logic gateLogic gate
Logic gate
 
Shift registers
Shift registersShift registers
Shift registers
 

Andere mochten auch

Moving message display
Moving message displayMoving message display
Moving message displayviraj1989
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 
Laboratory compaction study of fly ash mixed with lime precipitated electropl...
Laboratory compaction study of fly ash mixed with lime precipitated electropl...Laboratory compaction study of fly ash mixed with lime precipitated electropl...
Laboratory compaction study of fly ash mixed with lime precipitated electropl...eSAT Journals
 
A 64-by-8 Scrolling Led Matrix Display System
A 64-by-8 Scrolling Led Matrix Display SystemA 64-by-8 Scrolling Led Matrix Display System
A 64-by-8 Scrolling Led Matrix Display SystemSamson Kayode
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduinoyeokm1
 
5x7 matrix led display
5x7 matrix led display 5x7 matrix led display
5x7 matrix led display Vatsal N Shah
 
Digital Notice Board
Digital Notice BoardDigital Notice Board
Digital Notice BoardRaaki Gadde
 
Esp8266 NodeMCU
Esp8266 NodeMCUEsp8266 NodeMCU
Esp8266 NodeMCUroadster43
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Boardswarnimmaurya
 
Final Year Project on Fire Fighting systems
Final Year Project on Fire Fighting systemsFinal Year Project on Fire Fighting systems
Final Year Project on Fire Fighting systemsNaqash Kazmi
 
Basic electronics and electrical first year engineering
Basic electronics and electrical first year engineeringBasic electronics and electrical first year engineering
Basic electronics and electrical first year engineeringron181295
 
Intelligent Transportation System (ITS)
Intelligent Transportation System (ITS)Intelligent Transportation System (ITS)
Intelligent Transportation System (ITS)Jonathan D'Cruz
 

Andere mochten auch (20)

Moving message display
Moving message displayMoving message display
Moving message display
 
Review
ReviewReview
Review
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Catalogo unitronics 2012_intrave
Catalogo unitronics 2012_intraveCatalogo unitronics 2012_intrave
Catalogo unitronics 2012_intrave
 
Laboratory compaction study of fly ash mixed with lime precipitated electropl...
Laboratory compaction study of fly ash mixed with lime precipitated electropl...Laboratory compaction study of fly ash mixed with lime precipitated electropl...
Laboratory compaction study of fly ash mixed with lime precipitated electropl...
 
8x8 dot matrix(project)
8x8 dot matrix(project)8x8 dot matrix(project)
8x8 dot matrix(project)
 
A 64-by-8 Scrolling Led Matrix Display System
A 64-by-8 Scrolling Led Matrix Display SystemA 64-by-8 Scrolling Led Matrix Display System
A 64-by-8 Scrolling Led Matrix Display System
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
5x7 matrix led display
5x7 matrix led display 5x7 matrix led display
5x7 matrix led display
 
Maglev
MaglevMaglev
Maglev
 
Digital Notice Board
Digital Notice BoardDigital Notice Board
Digital Notice Board
 
Fire detection system operation
Fire detection system operationFire detection system operation
Fire detection system operation
 
Esp8266 NodeMCU
Esp8266 NodeMCUEsp8266 NodeMCU
Esp8266 NodeMCU
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Board
 
Final Year Project on Fire Fighting systems
Final Year Project on Fire Fighting systemsFinal Year Project on Fire Fighting systems
Final Year Project on Fire Fighting systems
 
Maglev trains
Maglev trains Maglev trains
Maglev trains
 
Diode
DiodeDiode
Diode
 
Final ppt maglev
Final ppt maglevFinal ppt maglev
Final ppt maglev
 
Basic electronics and electrical first year engineering
Basic electronics and electrical first year engineeringBasic electronics and electrical first year engineering
Basic electronics and electrical first year engineering
 
Intelligent Transportation System (ITS)
Intelligent Transportation System (ITS)Intelligent Transportation System (ITS)
Intelligent Transportation System (ITS)
 

Ähnlich wie Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9

Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdfJayanthi Kannan MK
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduinoSravanthi Sinha
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdfShashiKiran664181
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseElaf A.Saeed
 
Arduino and Robotics
Arduino and RoboticsArduino and Robotics
Arduino and RoboticsMebin P M
 
INT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdfINT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdfMSingh88
 
Mobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTechMobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTechstable|kernel
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuatorsEueung Mulyana
 

Ähnlich wie Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9 (20)

Arduino Programming
Arduino ProgrammingArduino Programming
Arduino Programming
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
 
Em s7 plc
Em s7 plcEm s7 plc
Em s7 plc
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
8051 TIMER COUNTER SERIAL COMM. INTERUPT PROGRAMMING.pdf
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Arduino and Robotics
Arduino and RoboticsArduino and Robotics
Arduino and Robotics
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
INT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdfINT4073 L07(Sensors and AcutTORS).pdf
INT4073 L07(Sensors and AcutTORS).pdf
 
Mobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTechMobile Development For Arduino 201 - ConnectTech
Mobile Development For Arduino 201 - ConnectTech
 
020419.pdf
020419.pdf020419.pdf
020419.pdf
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
Anup2
Anup2Anup2
Anup2
 
selected input/output - sensors and actuators
selected input/output - sensors and actuatorsselected input/output - sensors and actuators
selected input/output - sensors and actuators
 
Switch Control and Time Delay - Keypad
Switch Control and Time Delay - KeypadSwitch Control and Time Delay - Keypad
Switch Control and Time Delay - Keypad
 
Arduino.pptx
Arduino.pptxArduino.pptx
Arduino.pptx
 

Temperature Sensor with LED matrix Display BY ►iRFAN QADOOS◄ 9

  • 2. MAIN PROJECT To make a temperature sensor that outputs the reading as a scrolling message on a LED matrix. We used a LED matrix which is a common anode 8x8 display. Wired on breadboards.
  • 3. MAIN CONCEPT Use of two shift registers (2x 74HC595) to pass the encoded- charachter data serially from the arduino as a parallel output to the rows and Columns of an 8x8 LED matrix. The arduino handles the scrolling of the message and the periodic time-multiplexing of rows and columns (refresh rate = 100Hz), using a periodic interrupt, to which the function “screenUpdate” is attached. So , we calibrated the sensor using a potentiometer through the serial monitor window. then the complete circuit is connected.
  • 5. 74HC595-SHIFT REGISTERS -- An 8-bit shift register with Serial to parallel capability. -- We use two of them, Each one controlling eight rows/columns.
  • 6. LM335-TEMPERATURE SENSOR Calibration: -- We connect the calibration circuit , and connected it’s output as an analogue input to the arduino. -- With a potentiometer, and a small code... we used the serial monitor of arduino to fine-tune the sensor to give an acceptable reading (28°C for average room temperature).
  • 7. CODE#include <TimerOne.h> #include <charEncodings.h> // Each charachter and it’s (8x8 LED matrix)-mapped code. // BASIC PIN CONFIGURATION // AND DECLARATIONS //Pin connected to Pin 12 of 74HC595 (Latch) int latchPin = 8; //Pin connected to Pin 11 of 74HC595 (Clock) int clockPin = 12; //Pin connected to Pin 14 of 74HC595 (Data) int dataPin = 11; // pin for the potentiometer to control the scrolling speed int potPin = 5; // pin for reading the temperature int tempPin = 4; // this is the gobal array that represents what the matrix // is currently displaying uint8_t led[8];
  • 8. CODE void setup() { //set pins to output pinMode(latchPin, OUTPUT); pinMode(clockPin, OUTPUT); pinMode(dataPin, OUTPUT); pinMode(potPin, INPUT); pinMode(tempPin, INPUT); analogReference(INTERNAL); // attach the screenUpdate function to the interrupt timer // Period=10,000micro-second /refresh rate =100Hz Timer1.initialize(10000); Timer1.attachInterrupt(screenUpdate); }
  • 9. CODE //Continuous LOOP void loop() { long counter1 = 0; long counter2 = 0; char reading[10]; char buffer[18]; if (counter1++ >=100000) { counter2++; } if (counter2 >= 10000) { counter1 = 0; counter2 = 0; } getTemp(reading); displayScrolledText(reading); }
  • 10. THE (DISPLAYSCROLLEDTEXT ) FUNCTION void displayScrolledText(char* textToDisplay) { int textLen = strlen(textToDisplay); char charLeft, charRight; // scan through entire string one column at a time and call // function to display 8 columns to the right for (int col = 1; col <= textLen*8; col++) { // if (col-1) is exact multiple of 8 then only one character // involved, so just display that one if ((col-1) % 8 == 0 ) { char charToDisplay = textToDisplay[(col-1)/8]; for (int j=0; j<8; j++) { led[j] = charBitmaps[charToDisplay][j]; } } else { int charLeftIndex = (col-1)/8; int charRightIndex = (col-1)/8+1; charLeft = textToDisplay[charLeftIndex];
  • 11. // check we are not off the end of the string if (charRightIndex <= textLen) { charRight = textToDisplay[charRightIndex]; } else { charRight = ' '; } setMatrixFromPosition(charLeft, charRight, (col-1) % 8); } int delayTime = analogRead(potPin); delay (delayTime); } }
  • 12. void shiftIt(byte dataOut) { // Shift out 8 bits LSB first, // on rising edge of clock boolean pinState; //clear shift register read for sending data digitalWrite(dataPin, LOW); // for each bit in dataOut send out a bit for (int i=0; i<=7; i++) { //set clockPin to LOW prior to sending bit digitalWrite(clockPin, LOW); // if the value of DataOut and (logical AND) a bitmask // are true, set pinState to 1 (HIGH) if ( dataOut & (1<<i) ) { pinState = HIGH; } else { pinState = LOW; } //sets dataPin to HIGH or LOW depending on pinState digitalWrite(dataPin, pinState); //send bit out on rising edge of clock digitalWrite(clockPin, HIGH); digitalWrite(dataPin, LOW); }
  • 13. //stop shifting digitalWrite(clockPin, LOW); } boolean isKeyboardInput() { // returns true is there is any characters in the keyboard buffer return (Serial.available() > 0); } } // terminate the string readString[index] = '0'; }
  • 14. void setMatrixFromPosition(char charLeft, char charRight, int col) { // take col left most columns from left character and bitwise OR with 8-col from // the right character for (int j=0; j<8; j++) { led[j] = charBitmaps[charLeft][j] << col | charBitmaps[charRight][j] >> 8-col; } } void screenUpdate() { uint8_t col = B00000001; for (byte k = 0; k < 8; k++) { digitalWrite(latchPin, LOW); // Open up the latch ready to receive data shiftIt(~led[7-k]); shiftIt(col); digitalWrite(latchPin, HIGH); // Close the latch, sending the registers data to the matrix col = col << 1; } digitalWrite(latchPin, LOW); shiftIt(~0 ); shiftIt(255); digitalWrite(latchPin, HIGH); }
  • 15. void getTemp(char* reading) { int span = 20; int aRead = 0; long temp; char tmpStr[10]; // average out several readings for (int i = 0; i < span; i++) { aRead = aRead+analogRead(tempPin); } aRead = aRead / span; temp = ((100*1.1*aRead)/1024)*10; reading[0] = '0'; itoa(temp/10, tmpStr, 10); strcat(reading,tmpStr); strcat(reading, "."); itoa(temp % 10, tmpStr, 10); strcat(reading, tmpStr); strcat(reading, "C"); }