Hello, i´m trying to read the information that gives an 7 segment display. this display is sending the information to a mux TM1650 (in other board) and when i check the address´s founded out that every number (3) are in different address. so, what im doing is to conect de arduino to the sda and scl of the tm 1650. I was trying something like this:
#include <Wire.h>
#include <pt.h>
static struct pt pt1, pt2, pt3;
int a;
int b;
int c;
void setup() {
PT_INIT(&pt1);
PT_INIT(&pt2);
PT_INIT(&pt3);
Serial.begin(9600); // start serial for output
}
void loop() {
hilo1(&pt1);
hilo2(&pt2);
hilo3(&pt3);
delay(100);
suma(a,b,c);
}
void hilo1(struct pt *pt){
PT_BEGIN(pt);
Wire.begin(52); // join i2c bus with address #52
Wire.onReceive(receiveEvent); // register event
PT_END(pt);
}
void hilo2(struct pt *pt){
PT_BEGIN(pt);
Wire.begin(53); // join i2c bus with address #53
Wire.onReceive(receiveEvent2); // register event
PT_END(pt);
}
void hilo3(struct pt *pt){
PT_BEGIN(pt);
Wire.begin(54); // join i2c bus with address #54
Wire.onReceive(receiveEvent3); // register event
PT_END(pt);
}
// function that executes whenever data is received from master
// this function is registered as an event, see setup()
int receiveEvent(int howMany) {
a = Wire.read(); // receive byte as an integer
return a;
}
int receiveEvent2(int howMany) {
b = Wire.read(); // receive byte as an integer
return b ;
}
int receiveEvent3(int howMany) {
c = Wire.read(); // receive byte as an integer
return c;
}
void suma(int a, int b, int c){
Serial.print(a); Serial.print(" - ");Serial.print(b);Serial.print(" - "); Serial.println(c);
delay(100);
}
but when i print it , it just print the last wire information.
any suggestion?
ps: is my first time in the forum, so srry if i thit something wrong with the forum politics
ps2: the display is showing temperature