Skip to content

another bug about DUE Wire1 #3925

@shiftleftplusone

Description

@shiftleftplusone

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions