-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
When the Wire.requestFrom() returns, the I2C transaction has completely finished and the received bytes are waiting in a buffer in the Wire library. There is no need to wait for something to read those bytes from the buffer.
In the file "cu-perception-manipulation-stack/finger_sensor/arduino/sensorstrip_1_ino/sensorstrip_1_ino.ino", in the function "readByte()", you can remove the timeout with millis().
All you need is this:
Wire.requestFrom(VCNL4010_ADDRESS, 1);
byte data = Wire.read();
return data;
In the function "initSensorStrip()" you test for an acknowledge to test if it is really connected. I think that is enough. If you want, you could also test if the same number of bytes are received as was requested by testing if(Wire.available()==1). If you don't add that, the Wire.read() returns -1 in case of a problem.
Metadata
Metadata
Assignees
Labels
No labels