-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Board: Arduino DueApplies only to the DueApplies only to the DueLibrary: WireThe Wire Arduino libraryThe Wire Arduino library
Milestone
Description
just encountered:
for DUE-master to DUE-slave connected by i2c, the following code works, if both are running Wire (SDA+SCL).
(originally reported by "chhec", German Arduino Forum)
But connx fails, if one of them is using Wire1 (SDA1+SCL1)
What is going wrong with Wire1 ??
Master:
#include <Wire.h>
void setup()
{
Wire1.begin();
Serial.begin(9600);
}
void loop()
{
byte address=0x08;
byte x=100;
Wire1.beginTransmission(address);
Wire1.write(x);
Wire1.endTransmission();
delay(100);
}
Slave:
#include <Wire.h>
byte x;
void setup() {
Serial.begin(9600);
Wire.onReceive(empfangen);
Wire.begin(8);
}
void loop() {
Serial.println(x);
delay(100);
}
void empfangen (int numBytes)
{
while(Wire.available()<1);
while(Wire.available())
{
x = Wire.read();
}
}
Metadata
Metadata
Assignees
Labels
Board: Arduino DueApplies only to the DueApplies only to the DueLibrary: WireThe Wire Arduino libraryThe Wire Arduino library