hello there, I have finally managed to wright a script for working a small system I have. I have 3 stages in the system and all 3 are the same. what I am wondering is what do I call the second and third servos and pir sensors so the arduino doesn't get mixed up? can I just call them int pirPin2 =11 and int pirpos2 = 10
hear is a small bit of my script when only 1 servo and 1 pir sensor
int pirPin = 12; //digital pin connected to the PIR's output
int pirPos = 13; //connects to the PIR's 5V pin
int motorPin = 9; // dc motor
void setup(){
myservo.attach(4); //attaches servo to pin 4
Serial.begin(9600); //begins serial communication
pinMode(pirPin, INPUT);
pinMode(pirPos, OUTPUT);
digitalWrite(pirPos, HIGH);
pinMode(motorPin, OUTPUT);
//give the sensor time to calibrate
Serial.println("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(calibrationTime - i);
Serial.print("-");
delay(1000);
}
o right so I thought there was proper names to call them,
I have 2 servo motors and I keep getting s error when I have one myservo2,
are servos difrent to rename or am I doing something wrong
lukeob123:
o right so I thought there was proper names to call them,
I have 2 servo motors and I keep getting s error when I have one myservo2,
are servos difrent to rename or am I doing something wrong
Post the code that caused the error, and the error message.
As said before you can call them anything you like, and it makes sense for those names to relate to what they do.