Jump to content

Anshikajain

Members
  • Content Count

    5
  • Joined

  • Last visited

  1. Anshikajain

    I2C- MSP-EXP430G2ET

    It works now. Thank you! @NurseBob @Rei Vilo @energia
  2. Anshikajain

    I2C- MSP-EXP430G2ET

    @Rei Vilo I don't understand. Could you please explain this a little further?
  3. Anshikajain

    I2C- MSP-EXP430G2ET

    @Dani123 thankyou! PFA the zipped folder which contains three different codes that I've tried. Each folder contains two codes, one for each, the master and the slave. The folders named, '2' and '3' contain codes for lighting up a LED. Although, I haven't made a LED connection in the image of the circuit. The I2C bus connections however remain the same I'd be obliged if you could help me out with this. i2c.rar
  4. Anshikajain

    I2C- MSP-EXP430G2ET

    @NurseBob the coding here is in C. If you could help me out with energia, it would be great. Thanks!
  5. Anshikajain

    I2C- MSP-EXP430G2ET

    I2c not working with energia. Below is the code attached. Please help Master Reader #include <Wire.h> void setup() { Wire.setModule(0); Wire.begin(); // join i2c bus (address optional for master) Serial.begin(9600); // start serial for output } void loop() { Wire.requestFrom(2, 6); // request 6 bytes from slave device #2 while(Wire.available()) // slave may send less than requested { char c = Wire.read(); // receive a byte as character Serial.print(c); // print the character } delay(500); } Slave Sender . #include <Wire.h> void setup() { Wire.setModule(0); Wire.begin(2); // join i2c bus with address #2 Wire.onRequest(requestEvent); // register event } void loop() { delay(100); } // function that executes whenever data is requested by master // this function is registered as an event, see setup() void requestEvent() { Wire.write("hello "); // respond with message of 6 bytes // as expected by master }
×