case
mikea
Posts: 283
I'm having a problem getting "case" to work in this code. i can see in the pst that it is seeing the pulses accurately. The compiler highlights the"<" just below the case and expects an expression term. I've tried this different ways with no luck. What am i doing wrong? -mike
repeat waitpeq(%000, |< 2, 0) ' wait for Pin 2 to go low ' waitpeq(%100, |< 2, 0) 'Wait for Pin 2 to go high ' startpulsep:=cnt ' waitpeq(%000, |< 2, 0) ' wait for Pin 2 to go low ' endpulsep:=cnt ' read pulse width from receiver waitpeq(%100, |< 2, 0) 'Wait for Pin 2 to go high ' ' pulsewidthp:=endpulsep-startpulsep case pulsewidthp 'test current pulsewidth value against the values below it <120000 and <128000 : dead 'go to the dead method >128000 :down 'go to the down method <120000 :up 'go to the up method
Comments
Page 60, 61 of the manual.