It doesn't..It won't run unless I comment out the line:
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
I assumed the loop would plow on, regardless of an i2c request.
Currently the Grand Central is hanging out of my computer on a short cable with nothing connected.
Here is the code.. I have looked for this issue from others to no avail..
Code: Select all
// Wire Master Reader
// by Nicholas Zambetti <http://www.zambetti.com>
// Demonstrates use of the Wire library
// Reads data from an I2C/TWI slave device
// Refer to the "Wire Slave Sender" example for use with this
// Created 29 March 2006
// This example code is in the public domain.
#include <Wire.h>
void setup()
{
Serial.begin(115200); // start serial for output
Wire.begin(); // join i2c bus (address optional for master)
}
void loop()
{
Serial.println("Void Loop");
Wire.requestFrom(2, 6); // request 6 bytes from slave device #2
// while(Wire.available()) // slave may send less than requested
{
// char c = Wire.read(); // receive a byte as character
// Serial.println(c); // print the character
}
Serial.println("Last Line");
delay(500);
}
Any idea why?
Gary