Hi.
I am trying to transfer code from PBASIC to work on the Arduino - using High School examination questions to get them to move from flow charts/PBASIC to using the Arduino Uno.
I have the following circuit and code:
int guard = 7;
int switchPin = 6;
int motorPin = 9;
void setup(){
pinMode(guard,INPUT);
pinMode(switchPin,INPUT);
pinMode(motorPin,OUTPUT);
}
void loop(){
if (digitalRead(guard==HIGH)&&digitalRead(switchPin==HIGH)) //&&
{
digitalWrite(motorPin,HIGH);
delay(500);
digitalWrite(motorPin,LOW);
delay(1000);
}
else {
digitalWrite(motorPin,LOW);
}
}
The problem seems to be that the switches are being ignored. The motor works the way that it should but should only start when both switches are HIGH.
Any tips?
Thank you in advance
Debs
Int 2 platform lowering.pdf (245 KB)