You are reading a single comment by @user70647 and its replies. Click here to read the full conversation.
  • Hello All,
    I am New to Espruino and electronics. I Need help for one on my small project of I2C communication between atmega8 an esp8266, I just want to send I2C data from esp8266(master) and read at atmega8(slave[slaveid=1]) and same send data from atmega8(slave) to esp8266(master). any one have any idea? how I can do this....
    please help me....

    I try as following but still not work, is any one help me to know what I am doing wrong here :
    esp8266 code :

    var I = new I2C();
    console.log(I);
    var J = I.setup({scl:0, sda:2});
    console.log(J);
      setInterval(function(){
         console.log("I:::",I.readFrom(1,5));
      },1000);
    

    Atmega8 code :

    [#include](http://forum.espruino.com/sea­rch/?q=%23include) <Arduino.h>
    [#include](http://forum.espruino.com/sea­rch/?q=%23include) <Wire.h>
    void requestEvent();
    void setup() {	
    	Wire.begin(1);                // join i2c bus with address #1
    	pinMode(4,OUTPUT);
    	digitalWrite(4,HIGH);
    	pinMode(3,OUTPUT);
    	digitalWrite(3,HIGH);
    }
    void loop() {
    	delay(100);
    }
    
    // function that executes whenever data is requested by master
    // this function is registered as an event, see setup()
    void requestEvent() {
    	digitalWrite(3,LOW);
    	Wire.write("hello "); // respond with message of 6 bytes
    	// as expected by master
    }
    
About

Avatar for user70647 @user70647 started