Ошибка подключения Arduino и ESP 32 через i2c - PullRequest
0 голосов
/ 20 февраля 2019

У меня проблемы с подключением esp32 к arduino pro mini 3v3.мой код - тот же самый учебный пример arduino.Я использую атом, чтобы закодировать, и когда я открываю терминал, пишу нулевое сообщение

Мастер-код (Run ESP32)

 #include <Wire.h>
int i=0;
char c[20
];
#include <Wire.h>
#define I2C_SDA_PIN 21
#define I2C_SCL_PIN 22
void setup() {
  Wire.begin();        // join i2c bus (address optional for master)
  Serial.begin(9600);  // start serial for output
}

void loop() {
  Wire.requestFrom(8, 1);    // request 6 bytes from slave device #8

  while (Wire.available()>0) { // slave may send less than requested
     c[i]=Wire.read(); // receive a byte as character
     i++;
    Serial.print(c);         // print the character
  }
}

Запуск Arduino pro mini

#include <Wire.h>

void setup() {
  Wire.begin(8);                // join i2c bus with address #8
  Wire.onRequest(requestEvent); // register event
}

void loop() {
  delay(100);
}
// function that executes whenever data is requested by master
// this function is registered as an event, see setup()
void requestEvent() {
  Wire.write('h'); // respond with message of 6 bytes
  // as expected by master
}

Я сделалпроверка адреса шины i2c и распознавание arduino: снимок экрана Я ничего не нашел по этому поводу, если кто-нибудь может помочь

ps извините за мой плохой английский.

...