Connecting Cubecell to Arduino via i2c

Hi to all,

I tried to connect an arduino to a cubecell using this scketches:

The cubecell has this one

#include "Arduino.h"
#include <Wire.h>

#define I2C_YO 0x80
#define I2C_MONO_2 0x50

void setup() 
{
  Wire.begin(I2C_YO);
  Serial.begin(115200);
}

void loop() 
{
  Wire.beginTransmission(I2C_MONO_2);
  Wire.write("NAVIGATION");
  Wire.endTransmission();
  Serial.println("sending via i2c");   
  delay (2000);
}

And in the Arduino this is the code:

#include <Wire.h>
 
#define I2C_MONO_1 0x80
#define I2C_YO 0x50

String datos ="";

void setup() 
{
  Serial.begin(115200);
  Wire.begin(I2C_YO);
  Wire.onReceive(receiveI2C);
  Serial.println("mono ready");
}
 
void loop() {}
 
void receiveI2C(int howMany) 
{
  datos ="";
  while (Wire.available() > 0) {
    datos += (char)Wire.read();
  }
  Serial.println(datos);
}

Running both scketches into arduinos works ok.

Using a Cubecell and an Arduino the cubecell sends or at least appears each two seconds the “sending via i2c” in the serial monitor, but the Arduino only write “mono ready” and no more.

I tried to scan the i2c bus and it can not find the cubecell. Maybe is something not defined…

any idea? thanks!

PD: I use an special Arduino UNO with two system pwr, it can works on 5v or 3.3v. then is not a problem of different voltages in the bus.

I dont know if the cubecell can act as a iic slave.
The other way (cubecell as master) workd

thanks,

I do several tests and at the end I try to check with a BMP180 using the example and it didn’t work either, I use a second Cubecell and it works properly, something is wrong in the first one.

seems a pin had a contactless, after checking the connectors with the heat gun now it works and the scketches works ok, cubecell can be master or slave without problems.

Which library Wire.h you used?
I looking wire library supported i2c slave mode for CubeCell board.
I have an error during compilation:

undefined reference to `TwoWire::onReceive(void (*)(int))’

Bonmis

I use the default library of arduino.

I use the Arduino IDE to compile.

I configured the Arduino as this:

on “File- Preferences- additional card URL manager” (sorry if is not exactly the names,my Arduino is not in english) I have this json: https://dl.espressif.com/dl/package_esp32_index.json,https://docs.heltec.cn/download/package_CubeCell_index.json

after it, in Tools- Boards- card manager (sorry as before) write “cubecell” and appears the “Cubecell Standard Framework”, I’ve installed it and it is all I’ve done.

Conpile as cubecell board and your location parameters and in my case it works

I use Arduino versions 1.8.8, 1.8.10 and 1.8.12 and it works in all versions.

Probably I make mistake thinking I was using the Arduino default library.

This error may indicate the function you are calling is not defined. I check to call Wire.onRequest(function); and seems is not implemented. But in my case onReceive seems that works ok.

Last week I had a lot of work and no time to check the code. But next week I’ll try continue with tests.

In logs in Arduino IDE you can see whitch library is used.
Please check and answer,
I use this same json link.
Bonmis

sorry last two weeks were crazy, and actual too.

this is the information in library properties:

name=Wire
version=1.0
author=Arduino
maintainer=Arduino info@arduino.cc
sentence=This library allows you to communicate with I2C and Two Wire Interface devices.
paragraph=It allows the communication with I2C devices like temperature sensors, realtime clocks and many others using SDA (Data Line) and SCL (Clock Line).
category=Communication
url=http://www.arduino.cc/en/Reference/Wire
architectures=avr

sincerely