First page Back Continue Last page Overview Graphics
The PULSOUT command described below is very important for controlling servos (which we will cover later), but it can also be used for turning LEDs on and off.
The PULSOUT command described below is very important for controlling servos (which we will cover later), but it can also be used for turning LEDs on and off.
PULSOUT
- PULSOUT Pin Duration – this command is used to set the specified Pin HIGH for a time equal to Duration multiplied by 2 μs (2 millionths of a second, or 2 microseconds). The max value for duration is 65535 (or for 65535x2 μs = 0.13107 seconds)
Suppose that an LED (and resistor) is connected to output pin P4:
- PULSOUT 4 8 – the LED is lit for 8x2 μs = 16 μs
- PULSOUT 4 100 – the LED is lit for 100x2 μs = 0.2 ms (100 * 0.000002s = 0.0002)
- PULSOUT 4 5000 – the LED is lit for 5000x2 μs = 10 ms (5000 * 0.000002s = 0.01)
Note that the following two programs will accomplish the same thing: