Beginning Sensor Networks with XBee, Raspberry Pi, and Arduino by Charles Bell

Beginning Sensor Networks with XBee, Raspberry Pi, and Arduino by Charles Bell

Author:Charles Bell
Language: eng
Format: epub
ISBN: 9781484257968
Publisher: Apress


delay(5); // wait for chip to write data

}

/* Write a byte to the chip at specific index (offset). */

void write_byte(int address, unsigned int index, byte data) {

Wire.beginTransmission(address);

Wire.write((int)(index >> 8)); // MSB

Wire.write((int)(index & 0xFF)); // LSB

Wire.write(data);

Wire.endTransmission();

delay(5);

}

/* Read a sample from an index (offset). */

void read_sample(int address, unsigned int index, byte *buffer) {

Wire.beginTransmission(address);

Wire.write((int)(index >> 8)); // MSB

Wire.write((int)(index & 0xFF)); // LSB

Wire.endTransmission();



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.