User Manual

I
2
CDriver User Guide 20
6 Examples
The Python samples directory contains short examples of using all Electric
Dollar Store I
2
C modules:
Module Function Sample
DIG2 2-digit 7-seg display EDS-DIG2.py
LED RGB LED EDS-LED.py
POT potentiometer EDS-POT.py
BEEP Piezo beeper EDS-BEEP.py
REMOTE IR remote receiver EDS-REMOTE.py
EPROM CAT24C512 64 Kbyte EPROM EDS-EPROM.py
MAGNET LIS3MDL magnetometer EDS-MAGNET.py
TEMP LM75B temperature sensor EDS-TEMP.py
ACCEL RT3000C Accelerometer EDS-ACCEL.py
CLOCK HT1382 real-time clock EDS-CLOCK.py
All demos and applications are run the same way, supplying the I
2
CDriver on
the command-line. For example:
python EDS-LED.py COM16
Also included are some small applications which demonstrate combinations of
modules.
6.1 Color Compass
Source code: EDS-color-compass.py
Color compass uses MAGNET and LED, reading the current magnetic field
direction and rendering it as a color on the LED. As you twist the module, the
color changes. For example there is a particular direction for pure red, as well
as all other colors. The code reads the magnetic field direction, scales the
values to 0-255, and sets the LED color.
©2019 Excamera Labs