OLIMEX MOD-IO2 User Manual page 12

Extension board
Table of Contents

Advertisement

OLIMEX© 2024
MOD-IO2 user's manual
You can instead combine them in one line using i2ctrasnfer:
i2ctransfer –y 2 w1@0x21 0x10 r2
,where
r2 is the number of bytes to read, we need two bytes for this.
Expected results: on the terminal you would receive random and changing number or 0x00 or 0x08 or
0xFF whether you have the GPIO floating or set to 0V or set to 3.3V.
- Set all GPIOs to high level
i2cset –y 2 0x21 0x01 0x01
,where
0x01 is used to define port directions;
0x01 is the high level (for low level use 0x00).
- Reading state of GPIOs:
i2cset –y 2 0x21 0x01
i2cget –y 2 0x21
or as single command:
i2ctransfer –y 2 w1@0x21 0x01 r1
Detailed explanation of the preloaded software may be found in the firmware archive available for
download at MOD-IO2's web-page.
- Changing I2C device address – especially useful if you use more than one MOD-IO2
i2cset 2 0x21 0xF0 0xHH
,where
0xF0 is the command code for I2C change
HH is new address in hexadecimal format
Note that PROG jumper must be closed to be able to change the address. After the address change,
remember to open the jumper. If you forget the number of the address you can use the modio2tool to find
the address, the command and parameter would be "modio2tool -l". You can also reset the default address
(0x21) with the command and parameter "modio2tool -X".
- Set PWM1 (at GPIO6 pin)
i2cset –y 2 0x21 0x51 0x7f
7f is half the duty of PWM1
Page 12 of 28

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MOD-IO2 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents