This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class

I2C

Name

close()

Examples
import processing.io.*;
I2C i2c;

void setup() {
  //printArray(I2C.list());
  i2c = new I2C(I2C.list()[0]);
  // send a value over I2C to a digital-to-analog
  // converter with address 96 (hex 0x60)
  int val = 4095;
  i2c.beginTransmission(0x60);
  i2c.write(val >> 8);
  i2c.write(val & 255);
  i2c.endTransmission();
  // and close interface again
  i2c.close();
}

Description Closes the I2C device

It is normally not necessary to explicitly close I2C interfaces, as they are closed automatically by the operating system when the sketch exits.

Note: It is possible to have two or more object using the same interface at a time.
Syntax
.close()
Returnsvoid
Updated on October 2, 2018 05:02:13pm EDT

Creative Commons License