Dear,
The past week i have been putting my head arround the following question: " Can i prepare I2C communication between the ESP8266 and Picaxe 40x2 "
I have succesfully got communication working when using the ESP8266 as a Master with the following code
ESP8266- MASTER CODE
PICAXE 40x2 SLAVE CODE
However for my research i require the PICAXE to be master and the ESP8266 to be slave
I tried in several ways but until i was unsuccesfull in getting any comminication. I could not find any info on I2C communication with the PICAXE as master to any other chip but another PICAXE
I tried the following codes
PICAXE_MASTER
AND USED
WITH ESP(slave) CODE
both unsuccesfull, are there any suggestions on this matter?, Any ideas on i2C communication with PICAXE as master to either ESP(ARDUINO BASED) or ATMEGA328p(ARDUINO BASED) would be very appreciated !
Kind Regards,
The past week i have been putting my head arround the following question: " Can i prepare I2C communication between the ESP8266 and Picaxe 40x2 "
I have succesfully got communication working when using the ESP8266 as a Master with the following code
ESP8266- MASTER CODE
Code:
#include <Wire.h>
int i = 0;
boolean message = true;
void setup()
{
Wire.pins(4,5);
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop()
{
Wire.beginTransmission(14);
Wire.write(1); // Adress to write to
Wire.write(i); // data to write
Wire.write(0); // Extra no clue why but it makes it work stable
Wire.endTransmission();
Wire.beginTransmission(14);
Wire.write(2); // address to read from
Wire.endTransmission();
Wire.requestFrom(14, 1); // request one byte from address 14
while (Wire.available() > 0 )
{
byte c;
c = Wire.read();
Serial.print(c);
message = true;
}
if (i >= 255)
{
i = 0;
}
i++ ;
delay(100);
}
Code:
hi2csetup i2cslave, 14
do
get 2 , b2
put 1 , b2
pause 100
debug
loop
However for my research i require the PICAXE to be master and the ESP8266 to be slave
I tried in several ways but until i was unsuccesfull in getting any comminication. I could not find any info on I2C communication with the PICAXE as master to any other chip but another PICAXE
I tried the following codes
PICAXE_MASTER
Code:
hi2csetup i2cmaster, %10000000, i2cfast, i2cbyte
do
hi2cin [14],1,(b2)
pause 100
debug
loop
Code:
hi2csetup i2cmaster, %10000000, i2cfast, i2cbyte
do
hi2cout[14],1
pause 100
debug
loop
Code:
#include <Wire.h>
int i = 0;
boolean message = true;
void setup()
{
Wire.pins(4,5);
Wire.begin(14);
Wire.onRequest(requestEvent); // register event
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop()
{
while (Wire.available() > 0 )
{
byte c;
c = Wire.read();
Serial.print(c);
message = true;
}
if (i >= 255)
{
i = 0;
}
i++ ;
delay(100);
}
void requestEvent() {
Serial.println("EVENT");
Wire.write(25);
}
Kind Regards,