I am new to EV3 and Arduino. I have tried to connect an Arduino via I2C to the EV3. I am using the 1-byte read blocks and this is working fine.
The setup is as follows:
Arduino 1 is connected to a temperature/humidity sensor (DHT11).
Arduino 1 transmits temperature and humidity wireless to Arduino 2.
Arduino 2 receives data and sends temperature and humidity separately to the EV3. I use address 0x04 for temperature and 0x05 for humidity.
The EV3 receives data and sends it to the display.
This setup works as long as I use only one 1-byte read-block in the EV3. Thus I can only display temperature or humidity.
However, if I try to use multiple 1-byte read-blocks with two different slave addresses in order to display temperature and humidity at once, the EV3 program mixes the data of both blocks. As a result temperature and humidity is being displayed on the same spot on the display and flickers.
If I look into the "wires" between the blocks of the EV3 program while running, I can see that humidity and temperature are being transferred at once on every block. Thus it does not matter if I use the correct slave address on the read-blocks. Temperature and humidity are on the wires of every block at the same time .
See the attached code and the picture at the bottom.
I would be grateful if someone could help me figure out this problem.
Arduino 2 code:
#define SLAVE_ADDRESS_T 0x04
#define SLAVE_ADDRESS_H 0x05
#include <SPI.h> // Not actualy used but needed to compile
// Receive data from Arduino 1 and split data
memset(data, 0, sizeof(data));
uint8_t buflen = sizeof(buf);
if (driver.recv(buf, &buflen))
data[i] = char(buf[i]);
sscanf(data, "%d,%d", &temp, &hum);
// Transfer temp and hum to the EV3
void sendtemp ()
void sendhum ()