Skip to content

Instantly share code, notes, and snippets.

@nseidle
Last active September 29, 2016 17:21
Show Gist options
  • Save nseidle/e0ead19c893121b60157652ecc6c3f46 to your computer and use it in GitHub Desktop.
Save nseidle/e0ead19c893121b60157652ecc6c3f46 to your computer and use it in GitHub Desktop.
//Initialize the I2C port
bool Memory::begin(TwoWire &wirePort)
{
_i2cPort = &wirePort; //Grab which port the user wants us to use
_i2cPort->begin();
}
//Store a piece of data (thing) into a given address (place)
void Memory::writeValue(uint16_t place, uint8_t thing)
{
_i2cPort->beginTransmission((uint8_t)EEPROM_ADDRESS);
_i2cPort->write(place >> 8);
_i2cPort->write(place & 0xFF);
_i2cPort->write(thing);
_i2cPort->endTransmission();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment