Hello people! I've been working on this code and (since I am not super familiar with coding or arduino in general) I cannot figure out - even after reading through a bunch of similar issues - what I can do to get rid of that error. Pls, if you can, help me!! Thanks!
#include <HCSR04.h>
#include <DistanceSensor.h>
#define GREEN_led 5
#define BLUE_led 4
#define distanceSensor
const byte triggerPin = 9;
const byte echoPin = 10;
UltraSonicDistanceSensor sensor(triggerPin, echoPin);
void setup () {
Serial.begin(9600);
pinMode(GREEN_led, OUTPUT);
pinMode(BLUE_led, OUTPUT);
}
void loop () {
float distance = distanceSensor.measureDistanceCm();
Serial.println(distance);
delay(500);
if(distance_cm < 5)
{
digitalWrite(GREEN_led, HIGH);
digitalWrite(BLUE_led, LOW);
}
else if (distance_cm < 10)
{
digitalWrite(GREEN_led, LOW);
digitalWrite(BLUE_led, HIGH);
}
else
{
digitalWrite(GREEN_led, HIGH);
digitalWrite(BLUE_led, HIGH);
}
delay(250);
}