my code isnt working
. here it is l
/
int tiltball = 1;
int notup = 2;
int isup = 3;
void setup() {
pinMode(tiltball,INPUT);
pinMode(notup,OUTPUT);
pinMode(isup,OUTPUT);
}
void loop() {
if(digitalRead(tiltball) == HIGH) {
digitalWrite(isup,HIGH);
digitalWrite(notup,LOW);
}
else {
digitalWrite(isup,LOW);
digitalWrite(notup,HIGH);
}
}
also it is sposta turn on isup when a tilt ball switch is activated, else notup will turn on
Show us the error code(s) please.
b707
4
Please clarify, what does it mean, exactly?
Which MCU are you using that has pin 1 available for use as a GPIO pin?
As well as the question of what sort of Arduino you are using is also the question of how you have wired your tiltball?
I would have expected you to use an internal pull-up resistor. Have you got a circuit showing how you have wired it
system
Closed
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.