Reference+
Name
beginTransmission()
Class
I2C
Description
Begins a transmission to an attached device.
This function expects the address in the lower 7 bits, the same way as in
Arduino's Wire library, and as shown in the output of the i2cdetect tool. If
the address provided in a datasheet is greater than 127 (hex 0x7f) or there
are separate addresses for read and write operations listed, which vary
exactly by one, then you want to shift the this number by one bit to the
right before passing it as an argument to this function.
Examples
import processing.io.*; I2C dac; void setup() { //printArray(I2C.list()); dac = new I2C(I2C.list()[0]); } void draw() { background(map(mouseX, 0, width, 0, 255)); // send value over I2C to a digital-to-analog // converter with address 96 (hex 0x60) int val = int(4095 * map(mouseX, 0, width, 0.0, 1.0)); dac.beginTransmission(0x60); dac.write(val >> 8); dac.write(val & 255); dac.endTransmission(); }
Syntax
.beginTransmission(slave)
Return
void
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.