Takes about 8 minutes, 30 seconds to run one loop

Binary sketch size: 2,718 bytes (of a 32,256 byte maximum)#include "Wire.h"
#define I2C_ADDR 0x20 // 0x20 is the address with all jumpers removed
int stepval;
void setup()
{
Wire.begin(); // Wake up I2C bus
// Set addressing style
Wire.beginTransmission(I2C_ADDR);
Wire.write(0x12);
Wire.write(0x20); // use table 1.4 addressing
Wire.endTransmission();
// Set I/O bank A to outputs
Wire.beginTransmission(I2C_ADDR);
Wire.write(0x00); // IODIRA register
Wire.write(0x00); // Set all of bank A to outputs
Wire.endTransmission();
sendValueToLatch(0); // workaround to make sure all are off at start
}
void loop()
{
for (stepval = 0; stepval < 256; stepval++)
{
sendValueToLatch(stepval);
delay(1000);
}
for (stepval = 255; stepval >= 0; stepval--)
{
sendValueToLatch(stepval);
delay(1000);
}
}
void sendValueToLatch(int latchValue)
{
Wire.beginTransmission(I2C_ADDR);
Wire.write(0x12); // Select GPIOA
Wire.write(latchValue); // Send value to bank A
Wire.endTransmission();
}