hello there everybody. i'm really new at robotics but i made the starter kit from LMR and it worked perfectly :) now i'm just fooling around trying to make program myself. i wanted my servo to react to how close my hand is to the Sharp IR sensor. first i made 2 symbols (far and close) and said, that if variable "b0" is greater than the first symbol and less than the second. turn servo if not, return to main. and it worked just fine. now i want to make 3 symbols, for the robot to relate to.
here is what i'm trying:
symbol far = 30 symbol medium = 60 symbol close = 90
main: readadc 1, b0 debug if b0 > far and b0 < medium then gosub turn1 else gosub nothing if b0 > medium < close then gosub turn2 else gosub nothing end if goto main
the problem is that your main function will never get to the second “if”, try this (not sure about the syntax):
main: readadc 1, b0 debug if b0 > far and b0 < medium then gosub turn1 else if b0 > medium < close then gosub turn2 else gosub nothing end if goto main