Go Down

Topic: Please help me, it's for an important job. (Read 308 times) previous topic - next topic


• 1x Arduino
• 1x 16x2 LCD Display
• 1x Ultrasonic Sensor HC-SR04
• 2x Touch switch (buttons)
• 1x buzzer
• 1x Protoboard
Operation: It will be a distance meter for car, it will have 2 buttons (cm and in).
When connecting the Arduino, the distance in cm must be reported by pressing the button in
informs the distance in inches by pressing the cm button to inform the distance
in cm. If the distance is> 100cm does not mute the buzzer if it is between 100cm and
60cm whistles slowly, between 60cm and 45cm in average shape and 45cm to 4cm in
Please help me, it's for an important job.Please help me, it's for an important job.


I see you also have posted this in "Gigs and Collaborations"

If YOU want the job, then YOU have to do the work.
Post what you have done so far.


Safety is indeed important, so rather than cobble together a backup sensor, buy one. Here is a selection.


I found this on the internet and it is similar but I do not know how to put the two touch keys

// Program: Distance meter with HC-SR04
// Author: Arduino e Cia

#include <Ultrasonic.h> // Loads the Ultrasonic library
#include <LiquidCrystal.h> // Load the LCD library

// Defines the Arduino pin to be used with the sensor Trigger Pin
#define PINO_TRIGGER 13

// Defines the Arduino pin to be used with the Echo pin of the sensor
#define PINO_ECHO 10

// Initializes the ultrasonic sensor
Ultrasonic ultrasonic (PINO_TRIGGER, PINO_ECHO);

// Defines the pins that will be connected to the LCD
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);

void setup ()
  Serial.begin (9600); // Initialize the serial
  lcd.begin (16.2); // Initialize LCD
  lcd.clear (); // Clean LCD

void loop ()
  float cmMsec, inMsec;

  // Le sensor data, with signal return time
  long microsec = ultrasonic.timing ();

  // Calculate distance in centimeters
  cmMsec = ultrasonic.convert (microsec, Ultrasonic :: CM);

  // Calculate the distance in inches
  inMsec = ultrasonic.convert (microsec, Ultrasonic :: IN);

  // Displays the data, in centimeters, on the LCD and Serial
  lcd.setCursor (0,0);
  lcd.print ("Cent .:");
  lcd.print ("");
  lcd.setCursor (7,0);
  lcd.print (cmMsec);

  Serial.print ("Cent:");
  Serial.print (cmMsec);

  // Displays the data, in inches, on the LCD and Serial
  lcd.setCursor (0,1);
  lcd.print ("Pol.:");
  lcd.print ("");
  lcd.setCursor (7,1);
  lcd.print (inMsec);

  Serial.print (", Pol.:");
  Serial.println (inMsec);

  delay (1000);


Dec 14, 2018, 08:38 pm Last Edit: Dec 14, 2018, 08:39 pm by jremington
Use code tags when posting code ("</>" button), as described in "How to use this forum".

Follow one or more of the many Arduino on line tutorials to add buttons.

Go Up