|
The source code of all examples can be downloaded from a link in the right side bar. More examples will be subject to my whim. |
||
Example 1: Sensor data logger |
Aim:
Remarks: Since executing the code in the while loop takes some time to run, the sampling period is not exactly 50 ms. Typical trace: |
Example 2: Distance measurement using a infrared detector |
Infrared sensors are also used for light barriers, where a infrared source emits light not visible to the human eye. This may present some advantages over devices where the light beam is visible. Because many materials reflects infrared waves, a reflective light barrier are widely use in all kind of distance detectors. For short distances (1 - 100 cm) the light source is a photodiode (IR LED) that emits IR light around 1000 nm and a photodiode or phototransistor captures the reflection and translates the light intensity to a voltage
The distance-to-voltage relationship is completely non-linear (small distances produce a high light level and the resistance of the phototransistor becomes smaller, so the output voltage goes up). But In many proximity sensor applications, the absolute value of the distance is not of importance because the sensor is used to trigger an action, when the distance cross a certain level (from far to near or vice versa). Aim:
Remarks:
|
Example 3: Hand Follower: A funny application for the Kitronik buggy |
Aim: Program:
|
Example 4: Playing with the Kitronik :MOVE mini buggy |
Aim: Program:
|
Example 5: The micro:bit as sensor front-end to a Raspberry Pi |
Aim:
Remarks: You may check the presence of this additional serial device by calling ls /dev/tty* in a Linux terminal: At the time you insert the USB cable to the Raspberry Pi, the micro:bit is seen as a new removable device and a window opens. If you answer "YES", the device is shown in the File explorer as /media/pi/MICROBIT.
|