Arduino Project CTY SAR FCPS VEDANT MATHUR JULIANA

  • Slides: 12
Download presentation
Arduino Project CTY SAR FCPS VEDANT MATHUR, JULIANA SCHALKWYK

Arduino Project CTY SAR FCPS VEDANT MATHUR, JULIANA SCHALKWYK

Goal To get our LCD to display and update the time properly. To allow

Goal To get our LCD to display and update the time properly. To allow the knock circuit to detect knocks and accordingly perform demonstrations with the LEDs. Allow the LEDs to perform a given sequence of lighting.

Programming Time on LCD

Programming Time on LCD

Utility Project Part 1 Include all necessary libraries #include <Liquid. Crystal. h> #include <Time.

Utility Project Part 1 Include all necessary libraries #include <Liquid. Crystal. h> #include <Time. h> Initializing global variables The LCD itself needs to initialized as a Liquid. Crystal object “Liquid. Crystal lcd(12, 11, 5, 3, 2)” LED pin constants Knock sensor pin reference Knock sensor storage integer Threshold Increment Index

Utility Project Part 2 Setup() Begin LCD Set time Set pin. Modes Loop() print

Utility Project Part 2 Setup() Begin LCD Set time Set pin. Modes Loop() print time information run knock circuit function

CODE

CODE

Code Explanation The code began with the necessary include statements to the external libraries.

Code Explanation The code began with the necessary include statements to the external libraries. We incorporated the Liquid. Crystal library and the Time. h library to our project. Following that came the declaration of our global variables. We implemented specific pin references for our 3 LEDs and set the analog pin for the Knock sensor. The "increment. Index" variable was an integer that would keep track of the knock sensor's inputs. After that, we began the development of the setup() function. That function included the initialization of the LCD and the pin. Mode declarations. We then created two functions, print. Time() and knock. Circuit(), to complete the program. The print. Time() function formatted the given time from the Time library and printed it out in a viewable manner. The knock. Circuit function performed the scanning tasks of the knock sensor and accordingly ran the LEDs through their multiple sequences. These functions were then called in the loop() function.

Building the circuit

Building the circuit

Diagram of LED Circuit

Diagram of LED Circuit

Building the circuit For the circuit's development, we initially created two separate circuits and

Building the circuit For the circuit's development, we initially created two separate circuits and joined them together, connecting the pins to the Arduino.

Putting it All Together UPLOAD! Remember to check for the flashing RX and TX

Putting it All Together UPLOAD! Remember to check for the flashing RX and TX lights, and a “Successful upload” message in your console Understanding the process LCD RS pin to digital pin 12 LCD Enable pin to digital pin 11 LCD D 4 pin to digital pin 5 LCD D 5 pin to digital pin 4 LCD D 6 pin to digital pin 3 LCD D 7 pin to digital pin 2 LCD R/W pin to ground Knock sensor to A 0 and GND

Thank You!

Thank You!