eBoard ①⑧⑨
Written for SIA 2017/2018
[ ✍️ ] I2C

This tutorial shows you how to deal with the I²C extension! More...

This tutorial shows you how to deal with the I²C extension!

Note
To use this:
#define EBOARD_I2C 0x1
//Version 3.2
#define EBOARD_I2C_HELPER
If you use the ARDUINO MEGA the I2C pins are not A4 (SDA) and A5 (SDL). They are seperate (20-SDA;21-SDL)!

Example

An Example of how to scan for I2C addresses:

#define EBOARD_I2C 0x1
//Version 3.2
#define EBOARD_I2C_HELPER
#include <eBoard.h>
//manual: '#include "/path/to/eBoard.h"'
int main() {
optVAL_t test[3] = {0,0,0};
pingI2C(test,3);
Serial.println(test[0]);
return 0;
}

Connected an PCF8591 this produces this output:

72
0 -- Exit Code.
Program has finished. Reset to start again
Note
The size of the optVAL_t array can be as big as you want to... If its smaller than the amount of addresses found, the addresses will be lost.