if then else driving me crazy
I am writing a motor control program that will sense speed and bring output pins high for a variable amount of time to adjust for speed slow down or speed up.
The compiler keeps giving me an error saying "expected end of line or ':' ".
I have tried everything I can find to think of, however I cannot seem to resolve this error.
I have attached the program.
Thanks to anybody who can help!
The compiler keeps giving me an error saying "expected end of line or ':' ".
I have tried everything I can find to think of, however I cannot seem to resolve this error.
I have attached the program.
Thanks to anybody who can help!
bs2
![](/plugins/FileUpload/images/file.png)
2K
Comments
Lee
I suspect the following is what you really want in there:
IF (pulse1 < 30) THEN ' for 2000 rpms the time for one revolution is 30 ms
PULSOUT 1, 3
ELSEIF (pulse1 > 30) THEN
PULSOUT 1, 7
ELSE
PULSOUT 1, 5
ENDIF
The third conditional is superfluous to the logic. If pulse1 was neither higher nor lower than 30 it MUST be EQUAL to 30!
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->