aboutsummaryrefslogtreecommitdiff
path: root/libraries/Firmata/examples/I2CFirmata
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/Firmata/examples/I2CFirmata')
-rw-r--r--libraries/Firmata/examples/I2CFirmata/I2CFirmata.ino (renamed from libraries/Firmata/examples/I2CFirmata/I2CFirmata.pde)17
1 files changed, 14 insertions, 3 deletions
diff --git a/libraries/Firmata/examples/I2CFirmata/I2CFirmata.pde b/libraries/Firmata/examples/I2CFirmata/I2CFirmata.ino
index 11202e9..1da8963 100644
--- a/libraries/Firmata/examples/I2CFirmata/I2CFirmata.pde
+++ b/libraries/Firmata/examples/I2CFirmata/I2CFirmata.ino
@@ -1,4 +1,15 @@
/*
+ * Firmata is a generic protocol for communicating with microcontrollers
+ * from software on a host computer. It is intended to work with
+ * any host computer software package.
+ *
+ * To download a host software package, please clink on the following link
+ * to open the download page in your default browser.
+ *
+ * http://firmata.org/wiki/Download
+ */
+
+/*
Copyright (C) 2009 Jeff Hoefs. All rights reserved.
Copyright (C) 2009 Shigeru Kobayashi. All rights reserved.
@@ -48,7 +59,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes)
{
if (theRegister != REGISTER_NOT_SPECIFIED) {
Wire.beginTransmission(address);
- Wire.send((byte)theRegister);
+ Wire.write((byte)theRegister);
Wire.endTransmission();
delayMicroseconds(i2cReadDelayTime); // delay is necessary for some devices such as WiiNunchuck
}
@@ -63,7 +74,7 @@ void readAndReportData(byte address, int theRegister, byte numBytes)
i2cRxData[0] = address;
i2cRxData[1] = theRegister;
for (int i = 0; i < numBytes; i++) {
- i2cRxData[2 + i] = Wire.receive();
+ i2cRxData[2 + i] = Wire.read();
}
// send slave address, register and received bytes
Firmata.sendSysex(I2C_REPLY, numBytes + 2, i2cRxData);
@@ -95,7 +106,7 @@ void sysexCallback(byte command, byte argc, byte *argv)
Wire.beginTransmission(slaveAddress);
for (byte i = 2; i < argc; i += 2) {
data = argv[i] + (argv[i + 1] << 7);
- Wire.send(data);
+ Wire.write(data);
}
Wire.endTransmission();
delayMicroseconds(70); // TODO is this needed?