hi,
i trying adruino uno in 1 of 3 positions based on comparison between 2 number, 1 if equal other if first number bigger , final if second bigger. far have used if statement each different condition, , have used myservo.write() move servo, have used 0,90 , 180 positions work little but seems break down , doesnt work believe code should, appreciated.
my code:
if(playeronescore == playertwoscore) {
myservo.write(pos);
} else if(playeronescore > playertwoscore) {
myservo.write(180);
} else (playertwoscore > playeronescore) {
myservo.write(0);
}
i trying adruino uno in 1 of 3 positions based on comparison between 2 number, 1 if equal other if first number bigger , final if second bigger. far have used if statement each different condition, , have used myservo.write() move servo, have used 0,90 , 180 positions work little but seems break down , doesnt work believe code should, appreciated.
my code:
if(playeronescore == playertwoscore) {
myservo.write(pos);
} else if(playeronescore > playertwoscore) {
myservo.write(180);
} else (playertwoscore > playeronescore) {
myservo.write(0);
}
read stickies how use forum.
post formatted code between code tags, please. like this. upper left above emoticons </>.
post entire sketch. we have no idea else going on in rest of sketch , problem somewhere outside of snippet posted.
are using strings? how servos powered?
post formatted code between code tags, please. like this. upper left above emoticons </>.
code: [select]
if(playeronescore == playertwoscore)
{
myservo.write(pos);
}
else if(playeronescore > playertwoscore)
{
myservo.write(180);
}
else (playertwoscore > playeronescore)
{
myservo.write(0);
}
post entire sketch. we have no idea else going on in rest of sketch , problem somewhere outside of snippet posted.
are using strings? how servos powered?
quote
seems break down , doesn't work believe code should,is not descriptive. if take car shop, "it doesn't work"?
Arduino Forum > Using Arduino > Programming Questions > Servo Position based on a value
arduino
Comments
Post a Comment