How to connect an ultrasonic range finder and a serial lcd


In this short video we demonstrate how to connect an ultrasonic range finder to a serial lcd display. Follow the steps shown in the video and once you complete the wiring, download the code, and open it using Arduino IDE. Then replace the test code (in the firmware tab) to the one below:

#include "Global.h"

/* This code sets up the essentials for your circuit to work. It runs first every time your circuit is powered with electricity. */
void setup() {
// Setup Serial which is useful for debugging
// Use the Serial Monitor to view printed messages


/* This code is the main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop. */
void loop() {

    // The LCD Screen will display the text of your choice. For more serLCD functions see 
    serlcd.print("Distance");             // 2. Print print String to LCD
    serlcd.selectLine(2);                    // 3. Set cursor at the begining of line 2
    serlcd.print(ultraSonic.getCms());              // 4. print String to LCD
    delay(250);                             // 5. waits 1000 milliseconds (1 sec). Change the value in the brackets (1000) for a longer or shorter delay in milliseconds.
    serlcd.clear();                          // 6. Clear LCD screen.