Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.
Class | Wire |
||
---|---|---|---|
Name | peek() |
||
Examples | #include "Wire.h" void setup() { // join i2c bus (address optional for master) Wire.begin(); // start serial for output Serial.begin(9600); } void loop() { // request 6 bytes from slave device #2 Wire.requestFrom(2, 6); // slave may send less than requested while(Wire.available()) { // check the next available byte as character char c = Wire.peek(); Serial.print("The next character available is: "); Serial.println(c); // print the character } delay(500); } |
||
Description | The peek() method returns returns the value of the next byte available without doing a reading.. | ||
Syntax | Wire.peek()
|
||
Parameters |
|
||
Returns | The value for the next byte of data available or -1 if no data is available. | ||
Usage | Application |