COUNT
Syntax[edit]
COUNT input
Description[edit]
The count function returns the number of pulses counted on a digital sensor. The value of COUNT can be reset by the command COUNT CLEAR. A special feature of the motor commands also clears the value of COUNT. Any command issued to Motor A will reset COUNT 0, Motor B will reset COUNT 1 etc. The count function will normally return an integer showing the number of times a sensor, for example a switch, has closed. Every time the switch changes state and goes back again will register as 1 count, i.e. from off to on and off again. The count function can also be used to record the number of changes of state, i.e. the number of times the sensor has changed from either on to off or off to on. Every transition registers as 0.5
Examples[edit]
Reset counter on INPUT 0 to zero
COUNT CLEAR 0
Reset all counters to zero
COUNT CLEAR
Switch on a motor until INPUT 0 registers 10 counts.
COUNT CLEAR FORWARD A WAIT UNTIL COUNT 0 >=10