source: rtos_arduino/trunk/arduino_lib/hardware/arduino/samd/cores/validation/validation_I2C_I01/test.cpp@ 136

Last change on this file since 136 was 136, checked in by ertl-honda, 8 years ago

ライブラリとOS及びベーシックなサンプルの追加.

File size: 538 bytes
Line 
1#include "Arduino.h"
2#include <Wire.h>
3const uint8_t addressTemp = 0x4Ful;
4uint16_t temp = 0;
5uint8_t a, b;
6void setup()
7{
8 Serial5.begin( 115200 );
9 Serial5.println("Wire init");
10 Wire.begin();
11}
12
13void loop()
14{
15 Wire.beginTransmission(addressTemp);
16 Wire.write((uint8_t) 0x00);
17 Wire.endTransmission();
18
19 delay(100);
20
21 Wire.requestFrom(addressTemp, 2);
22 Serial5.print((char)13);
23 Serial5.print("Temperature : ");
24
25 a = Wire.read();
26 b = Wire.read();
27
28 temp = b << 7;
29 temp |= a;
30 temp >>= 7;
31
32 Serial5.print(temp);
33}
Note: See TracBrowser for help on using the repository browser.