nanoI2CSlaveExpander
ARDUINO Nano v3 used as I2C slace digital and analog io expander for ESP8266 and others...
CNanoI2CIOExpander Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ CNanoI2CIOExpander()

CNanoI2CIOExpander::CNanoI2CIOExpander ( )
inline

Definition at line 39 of file nanoI2CIOExpLib.h.

Member Function Documentation

◆ analogRead()

int CNanoI2CIOExpander::analogRead ( int  input)

A method tha return 10bits value of one of the 6 analog inputs...

Parameters
inputanalog input number from 0 to 5
Returns
read value

Warning : mapping of analog inputs on ARDUINO Nano:

  • 0 A0
  • 1 A1
  • 2 A2
  • 3 A3
  • 4 A6
  • 5 A7

Definition at line 115 of file nanoI2CIOExpLib.cpp.

◆ begin()

void CNanoI2CIOExpander::begin ( int  add = 0x5F)

function that start the I2C protocol with nanoI2CIOExpander

Parameters
addthe I2C address of the componant...
Returns
nothing

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.

◆ digitalRead()

int CNanoI2CIOExpander::digitalRead ( int  input)

Well knonwn function digitalRead applie to nanoI2CIOExpander but...

Parameters
inputthe number of the input
Returns
the read value
Warning
input number from 0 to 10 corresponding to D2 to D12 on the nano

Definition at line 79 of file nanoI2CIOExpLib.cpp.

◆ digitalWrite()

void CNanoI2CIOExpander::digitalWrite ( int  output,
int  value 
)

Definition at line 88 of file nanoI2CIOExpLib.cpp.

◆ pinMode()

void CNanoI2CIOExpander::pinMode ( int  output,
int  mode 
)

A method to set the pinMode but...

Parameters
outputfrom 0 to 10
modeINPUT, OUTPUT or INPUT_PULLUP
Returns
nothing
Warning
input number from 0 to 10 corresponding to D2 to D12 on the nano

Definition at line 47 of file nanoI2CIOExpLib.cpp.

◆ test()

bool CNanoI2CIOExpander::test ( )

A special test method that use 2 special register to write and read and display on the Serial monitor results...

Returns
true if all test is OK (new in 2.1 lib)

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.

Member Data Documentation

◆ initOk

bool CNanoI2CIOExpander::initOk = false
static

Definition at line 46 of file nanoI2CIOExpLib.h.


The documentation for this class was generated from the following files: