avatar

Marece

Member Since: May 31, 2010

Country: United States

  • With Interrupt

    //All three address pins to ground
    #include <Wire.h>
    int interruptPin=2;
    int i;
    
    void setup()
    {
      Wire.begin();        // join i2c bus (address optional for master)
      Serial.begin(9600);  // start serial for output
      pinMode(interruptPin, INPUT);
    }
    
    void loop(){
      i=digitalRead(interruptPin);
    
      if(i==0){
        Wire.requestFrom(32, 2);
        while(Wire.available())    // slave may send less than requested
          { 
            byte c = Wire.read(); // receive a byte as BYTE
            Serial.println(c, BIN); // print the data
          }
          Serial.println(); //Puts a line in serial terminal
        }
    }
    

No public wish lists :(