Hi people, Hope everythis is good for all of you. for me im going nuts. using basic i can right up some script no problem but this seems to be verry diferent and quite confusing.
I live in a campground and we employ a security gate for after hours access and exit. We have had unothorised people in the park making quite a mess and i foolishly offered to use an Arduino as a controller to our problem.
("xxxxxx" was not declaired in this scope) is keeping me up at night. I dont seem to be getting an answer i can understand. I am a total greenhorn to this Arduino.
A breef discription as to how it is supose to work and then i will past the nightmerish code for the world to see, hopfull to get some direction on this.
so
Gate: we have three inground sencing loops and one security keypad. the three loops i call. Exit, Enter, Presence the way it is working now is, exit opens gate presence keeps gate open, enter keeps gate open while exiting. the way unothorised access is gained is if a vehical creeps up close enough to the presence pad in the middle of the gate it will oppen due to the fact that this pad is there for safty sake, the second way is that a guest on the inside will pull up to the exit pad oppening the gate for the unothorised party and backing up as they follow then in.
I may be way off with this so called code but its all i got at the moment so. Hear it is...
#include <ezButton.h>
ezButton pade (3);
ezButton padp (4);
ezButton padx (5);
ezButton padk (6);
const int gatepin = 8;
const int slightpin = 9;
const int nlightpin = 10;
void setup() {
Serial.begin (9600);
pade.setDebounceTime(40);
padp.setDebounceTime(40);
padx.setDebounceTime(40);
padk.setDebounceTime(40);
pinMode(gatepin, OUTPUT);
pinMode(slightpin, OUTPUT);
pinMode(nlightpin, OUTPUT);
}
void loop() {
pade.loop();
padp.loop();
padx.loop();
padk.loop();
if(padx.isPressed());
if(pade.isPressed());
if(padp.isReleased());
pad digitalWrite(nlightPin, HIGH);//red
digitalWrite(slightPin, HIGH);//red
if(padx.isPressed());
if(pade.isReleased());
if(padp.isReleased());
digitalWrite(gatePin, HIGH);//open gate
digitalWrite(nlightPin, HIGH);//red
digitalWrite(slightPin, LOW);//green
if(padx.isReleased());
if(pade.isReleased());
if(padp.isReleased());
digitalWrite(gatePin, LOW);//close gate
digitalWrite(nlightPin, LOW);//geen
digitalWrite(slightPin, LOW);//green
if(pade.isPressed());
if(padx.isPressed());
if(padp.isReleased());
digitalWrite(nlightPin, HIGH);//red
digitalWrite(slightPin, HIGH);//red
if(pade.isPressed());
if(padk.isPressed());
if(padp.isReleased());
digitalWrite(gatePin, HIGH);//open gate
digitalWrite(slightPin, HIGH);//red
digitalWrite(nlightPin, LOW);//green
//if(padx.isReleased());
if(padp.isReleased());
//if(padp.isReleased());
digitalWrite(gatePin, LOW);//close gate
digitalWrite(nlightPin, LOW);//geen
digitalWrite(slightPin, LOW);//green
}
if(padx.isReleased());
Serial.println("exit clear");
if(pade.isPressed());
Serial.println("enter");
digitalWrite(gatepin, HIGH);
if(pade.isReleased());
Serial.println("enter clear");
if(padp.isPressed());
Serial.println("pres");
if(padp.isReleased());
Serial.println("presence clear");
if(padk.isPressed());
Serial.println("keypad");
if(padk.isReleased());
Serial.println("keypad time-out");
Arduino: 1.8.19 (Windows 10), Board: "Arduino Uno"
`````````````````````````````````````````````````
the tonne of error mesages::::::::
C:\Users\fal\Documents\Arduino\multibutton\multibutton.ino: In function 'void loop()':
multibutton:37:17: error: 'nlightPin' was not declared in this scope
digitalWrite(nlightPin, HIGH);//red
^~~~~~~~~
C:\Users\fal\Documents\Arduino\multibutton\multibutton.ino:37:17: note: suggested alternative: 'nlightpin'
digitalWrite(nlightPin, HIGH);//red
^~~~~~~~~
nlightpin
multibutton:38:17: error: 'slightPin' was not declared in this scope
digitalWrite(slightPin, HIGH);//red
^~~~~~~~~
C:\Users\fal\Documents\Arduino\multibutton\multibutton.ino:38:17: note: suggested alternative: 'slightpin'
digitalWrite(slightPin, HIGH);//red
^~~~~~~~~
slightpin
multibutton:42:17: error: 'gatePin' was not declared in this scope
digitalWrite(gatePin, HIGH);//open gate
^~~~~~~
C:\Users\fal\Documents\Arduino\multibutton\multibutton.ino:42:17: note: suggested alternative: 'gatepin'
digitalWrite(gatePin, HIGH);//open gate
^~~~~~~
gatepin
C:\Users\fal\Documents\Arduino\multibutton\multibutton.ino: At global scope:
multibutton:71:1: error: expected unqualified-id before 'if'
if(padx.isReleased());
^~
multibutton:72:5: error: 'Serial' does not name a type
Serial.println("exit clear");
^~~~~~
multibutton:73:1: error: expected unqualified-id before 'if'
if(pade.isPressed());
^~
multibutton:74:4: error: 'Serial' does not name a type
Serial.println("enter");
^~~~~~
multibutton:75:16: error: expected constructor, destructor, or type conversion before '(' token
digitalWrite(gatepin, HIGH);
^
multibutton:76:1: error: expected unqualified-id before 'if'
if(pade.isReleased());
^~
multibutton:77:5: error: 'Serial' does not name a type
Serial.println("enter clear");
^~~~~~
multibutton:78:1: error: expected unqualified-id before 'if'
if(padp.isPressed());
^~
multibutton:79:4: error: 'Serial' does not name a type
Serial.println("pres");
^~~~~~
multibutton:80:1: error: expected unqualified-id before 'if'
if(padp.isReleased());
^~
multibutton:81:5: error: 'Serial' does not name a type
Serial.println("presence clear");
^~~~~~
multibutton:82:1: error: expected unqualified-id before 'if'
if(padk.isPressed());
^~
multibutton:83:4: error: 'Serial' does not name a type
Serial.println("keypad");
^~~~~~
multibutton:84:1: error: expected unqualified-id before 'if'
if(padk.isReleased());
^~
multibutton:85:5: error: 'Serial' does not name a type
Serial.println("keypad time-out");
^~~~~~
multibutton:90:1: error: expected declaration before '}' token
}
^
exit status 1
'nlightPin' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Than you for any assistance you can provide.