test program of I2C
Dependencies: mbed
Fork of CatPotI2CMAstertest by
Revision 1:b55a8d5cce29, committed 2014-12-15
- Comitter:
- lilac0112_1
- Date:
- Mon Dec 15 09:48:42 2014 +0000
- Parent:
- 0:cafd8b891544
- Commit message:
- Confirmed performance
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r cafd8b891544 -r b55a8d5cce29 main.cpp --- a/main.cpp Mon Dec 15 07:37:44 2014 +0000 +++ b/main.cpp Mon Dec 15 09:48:42 2014 +0000 @@ -1,3 +1,7 @@ +/* +*動作確認済み +*超音波センサーのデータをスレーブから受け取る +*/ #include "mbed.h" #define ADDRESS 0xA0 @@ -13,16 +17,13 @@ uint8_t val; - //Mbed.frequency(9600); - while(1) { val = Mbed.write(ADDRESS, NULL, DATA_NUM); // PINGデータを要求 - myled = !val; + myled = !val;//成功すれば点灯 wait_ms(5); val = Mbed.read(ADDRESS, STONE, DATA_NUM);// PINGデータを受信 - pc.printf("%d\n", STONE[0]); wait_ms(0.1); }