Reference   Language | Libraries | Comparison | Changes

Wire.send(value)

Wire.send(string)

Wire.send(data, quantity)

Description

Sends data from a slave device in response to a request from a master, or queues bytes for transmission from a master to slave device (in-between calls to beginTransmission() and endTransmission()).

Parameters

value: a byte to send (byte)

string: a string to send (char *)

data: an array of data to send (byte *)

quantity: the number of bytes of data to transmit (byte)

Returns

None

Code


void setup()
{
Wire.begin(); // Start I2C Bus as Master
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
}

void loop()
{
Wire.beginTransmission(9); // transmit to device #9
Wire.send(x); // sends x
Wire.endTransmission(); // stop transmitting
x++;
if (x > 5) x=0;
delay(500);
}

See Also

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

Share