source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/libraries/Wire/examples/master_writer/master_writer.ino @ 46

Last change on this file since 46 was 46, checked in by jrpelegrina, 4 years ago

First release to Xenial

File size: 646 bytes
Line 
1// Wire Master Writer
2// by Nicholas Zambetti <http://www.zambetti.com>
3
4// Demonstrates use of the Wire library
5// Writes data to an I2C/TWI slave device
6// Refer to the "Wire Slave Receiver" example for use with this
7
8// Created 29 March 2006
9
10// This example code is in the public domain.
11
12
13#include <Wire.h>
14
15void setup() {
16  Wire.begin(); // join i2c bus (address optional for master)
17}
18
19byte x = 0;
20
21void loop() {
22  Wire.beginTransmission(8); // transmit to device #8
23  Wire.write("x is ");        // sends five bytes
24  Wire.write(x);              // sends one byte
25  Wire.endTransmission();    // stop transmitting
26
27  x++;
28  delay(500);
29}
Note: See TracBrowser for help on using the repository browser.