Im trying to make a program, that when someone gets close and triggers the ultrasonic sensor, it sends power/turns on an lcd screen, but I keep getting errors.
Here is the full error message and attached is the code so far if anyone can please help me.
In function 'void setup()':
Final:56:18: error: 'trigger_pin' was not declared in this scope
pinMode (trigger_pin, OUTPUT);
^~~~~~~~~~~
Final:58:18: error: 'echo_pin' was not declared in this scope
pinMode (echo_pin, INPUT);
^~~~~~~~
Final:60:18: error: 'buzzer_pin' was not declared in this scope
pinMode (buzzer_pin, OUTPUT);
^~~~~~~~~~
In function 'void loop()':
Final:68:17: error: 'trigger_pin' was not declared in this scope
digitalWrite (trigger_pin, HIGH);
^~~~~~~~~~~
Final:74:5: error: 'time' was not declared in this scope
time = pulseIn (echo_pin, HIGH);
^~~~
74:5: note: suggested alternative: 'tone'
time = pulseIn (echo_pin, HIGH);
^~~~
tone
Final:74:21: error: 'echo_pin' was not declared in this scope
time = pulseIn (echo_pin, HIGH);
^~~~~~~~
Final:76:5: error: 'distance' was not declared in this scope
distance = (time * 0.034) / 2;
^~~~~~~~
note: suggested alternative: 'isSpace'
distance = (time * 0.034) / 2;
^~~~~~~~
isSpace
Final:90:23: error: 'buzzer_pin' was not declared in this scope
digitalWrite (buzzer_pin, HIGH);
^~~~~~~~~~
Final:104:23: error: 'buzzer_pin' was not declared in this scope
digitalWrite (buzzer_pin, LOW);
^~~~~~~~~~
Sensor:14:16: error: a function-definition is not allowed here before '{' token
void setup ( ) {
^
Sensor:32:15: error: a function-definition is not allowed here before '{' token
void loop ( ) {
^
Sensor:76:3: error: expected '}' at end of input
}
^
exit status 1
'trigger_pin' was not declared in this scope
Final_help.ino (1.16 KB)