This project is maintained by lawrie
Prev | Up | Next |
Sensors usually have an GPIO (digital), SPI, I2C, ADC or UART interface.
The simplest digital sensors are buttons and sliders which were covered in the built-in hardware chapter above.
Other digital sensors measure a pulse. An HC-SR04 ultrasonic ping sensor is such a device. It uses an output (trigger) pin to request a range measurement and then measures the length of the pulse on an input (echo) pin.
See the ping and example, which displays the distance to an object on the myStorm 3-digit 7-segment display. See also the Robotics chapter, for another use of an HC-SR04 sensor.
Other types of sensor use quadrature to count rotations. Two signals with a 90-degree phase difference allow the direction of rotation to be measured. See the quad example, which displays a 12-bit value from a quadrature rotary sensor in hex on the myStorm 7-segment display.
The encoders on encoder motors are also quadrature rotation sensors. See the Actuators and Robotics chapters.
Prev | Up | Next |