Last change
on this file since 136 was 136, checked in by ertl-honda, 8 years ago |
ライブラリとOS及びベーシックなサンプルの追加.
|
File size:
648 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 |
|
---|
15 | void setup()
|
---|
16 | {
|
---|
17 | Wire.begin(); // join i2c bus (address optional for master)
|
---|
18 | }
|
---|
19 |
|
---|
20 | byte x = 0;
|
---|
21 |
|
---|
22 | void loop()
|
---|
23 | {
|
---|
24 | Wire.beginTransmission(4); // transmit to device #4
|
---|
25 | Wire.write("x is "); // sends five bytes
|
---|
26 | Wire.write(x); // sends one byte
|
---|
27 | Wire.endTransmission(); // stop transmitting
|
---|
28 |
|
---|
29 | x++;
|
---|
30 | delay(500);
|
---|
31 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.