Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CatPotI2CSlavetest by
Revision 1:178963fb9f75, committed 2014-12-15
- Comitter:
- lilac0112_1
- Date:
- Mon Dec 15 09:51:15 2014 +0000
- Parent:
- 0:dcc9cf1071f1
- Commit message:
- Confirmed performance
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 15 07:37:14 2014 +0000
+++ b/main.cpp Mon Dec 15 09:51:15 2014 +0000
@@ -1,3 +1,7 @@
+/*
+*動作確認済み
+*超音波センサーのデータをマスターに送信
+*/
#include "mbed.h"
#include "Ping.h"
@@ -21,19 +25,24 @@
char Export[DATA_NUM]={0};
uint8_t cycle=0;
- Tiny.address(ADDRESS);
- //Tiny.frequency(9600);
+ int i;
+
+ Tiny.address(ADDRESS);//アドレスの定義
while(1) {
Sensor.Send();
wait_ms(30);
- Export[cycle%DATA_NUM] = 0xAA;//Sensor.Read_cm();
+ Export[cycle%DATA_NUM] = Sensor.Read_cm();
+
+ cycle++;//配列移動
- cycle++;
+ myled = (Tiny.receive() == I2CSlave::ReadAddressed);//成功すれば点滅
- switch(Tiny.receive()){
+ i = Tiny.receive();
+
+ switch(i){//変数を介するとうまく動作した.
case I2CSlave::ReadAddressed:
Tiny.write(Export, DATA_NUM); // Includes null char
