![]() |
nanoI2CSlaveExpander
ARDUINO Nano v3 used as I2C slace digital and analog io expander for ESP8266 and others...
|
A class to provide usual io functioon for nanoI2CIOExpander project... More...
#include <nanoI2CIOExpLib.h>
Public Member Functions | |
CNanoI2CIOExpander () | |
void | begin (int add=0x5F) |
function that start the I2C protocol with nanoI2CIOExpander More... | |
void | pinMode (int output, int mode) |
A method to set the pinMode but... More... | |
int | digitalRead (int input) |
Well knonwn function digitalRead applie to nanoI2CIOExpander but... More... | |
void | digitalWrite (int output, int value) |
int | analogRead (int input) |
A method tha return 10bits value of one of the 6 analog inputs... More... | |
bool | test () |
A special test method that use 2 special register to write and read and display on the Serial monitor results... More... | |
Static Public Attributes | |
static bool | initOk = false |
A class to provide usual io functioon for nanoI2CIOExpander project...
Functions provided are begin, pinMode, digitalRead, digitalWrite, analogRead
Definition at line 36 of file nanoI2CIOExpLib.h.
|
inline |
Definition at line 39 of file nanoI2CIOExpLib.h.
int CNanoI2CIOExpander::analogRead | ( | int | input | ) |
A method tha return 10bits value of one of the 6 analog inputs...
input | analog input number from 0 to 5 |
Warning : mapping of analog inputs on ARDUINO Nano:
Definition at line 115 of file nanoI2CIOExpLib.cpp.
void CNanoI2CIOExpander::begin | ( | int | add = 0x5F | ) |
function that start the I2C protocol with nanoI2CIOExpander
add | the I2C address of the componant... |
The default address of the componant is 0x58 Can be fixed from 0x58 to 0x59 with D12D10D11 pin of the Nano The only one adress pin D13 is pulled-down (so no connect value is 0)
Definition at line 28 of file nanoI2CIOExpLib.cpp.
int CNanoI2CIOExpander::digitalRead | ( | int | input | ) |
Well knonwn function digitalRead applie to nanoI2CIOExpander but...
input | the number of the input |
Definition at line 79 of file nanoI2CIOExpLib.cpp.
void CNanoI2CIOExpander::digitalWrite | ( | int | output, |
int | value | ||
) |
Definition at line 88 of file nanoI2CIOExpLib.cpp.
void CNanoI2CIOExpander::pinMode | ( | int | output, |
int | mode | ||
) |
A method to set the pinMode but...
output | from 0 to 10 |
mode | INPUT, OUTPUT or INPUT_PULLUP |
Definition at line 47 of file nanoI2CIOExpLib.cpp.
bool CNanoI2CIOExpander::test | ( | ) |
A special test method that use 2 special register to write and read and display on the Serial monitor results...
first write 0x10 to register Test1 (reg add = 1) and write 0x12 to register Test2 (reg add = 2) and re-read the values and display them on Serial monitor
Definition at line 169 of file nanoI2CIOExpLib.cpp.
|
static |
Definition at line 46 of file nanoI2CIOExpLib.h.