2012-12-06 02:27 AM
Hi
I use STBee. When I perform I2C in Arduino, I write such a code. void writeDevice(byte address, byte registerAddress, byte data){ Wire.beginTransmission(address); Wire.write(registerAddress); Wire.write(data); Wire.endTransmission(); } byte readDevice(byte address, byte registerAddress){ byte data = 0; Wire.beginTransmission(address); Wire.write(registerAddress); Wire.endTransmission(); Wire.beginTransmission(address); Wire.requestFrom((char)address,1); if(Wire.available()){ data = Wire.read(); } Wire.endTransmission(); return data; } There is a question about a function of Wire.requestFrom of this cord. It is a function to require 1 byte to a device. When I want to use this function in STBee, how should I do it?2012-12-06 02:52 AM
I2C communicates with an acceleration sensor(ADXL345).