I need a little bit of an explanation of the use of 'byte' in the following code where it is used say, in Setup with Wire.write. Are they consecutive empty instructions after addressing the chip to set the outputs?
/*
** MCP23017 16 bit Port Expander
** Example code to flash LED on GPB0
** Created 06 Aug 2012
**
** This example code is in the public domain.
** www.hobbytronics.co.uk
*/
#include <Wire.h>
const byte mcp_address=0x20; // I2C Address of MCP23017 Chip
const byte GPIOA=0x12; // Register Address of Port A
const byte GPIOB=0x13; // Register Address of Port B
void setup()
{
//Send settings to MCP device
Wire.begin(); // join i2c bus (address optional for master)
// IOCON.BANK defaults to 0 which is what we want.
// So we are using Table 1-4 on page 9 of datasheet
Wire.beginTransmission(mcp_address); //=0x20
Wire.write((byte)0x00); // IODIRA register
Wire.write((byte)0x00); // set all of bank A to outputs
Wire.write((byte)0x00); // set all of bank B to outputs
Wire.endTransmission();
}
void loop()
{
Wire.beginTransmission(mcp_address);
Wire.write(GPIOB); // address bank B
Wire.write((byte)0xFF); // value to send - all HIGH
Wire.endTransmission();
delay(500);
Wire.beginTransmission(mcp_address);
Wire.write(GPIOB); // address bank B
Wire.write((byte)0x00); // value to send - all LOW
Wire.endTransmission();
delay(500);
}