All Forums > Website Questions

Wire library (writer)arduino

(1/1)

baligh1979:
my vertion in arduino 1.5.5.r2
what is wrong in code follow

#include <Wire.h>

void setup()
{
  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
                 

Navigation

[0] Message Index

Go to full version