4 #include "BTConnection.h"
5 #include "TouchSensor.h"
6 #include "ETTailControl.h"
10 using namespace ecrobot;
13 /* 固有のパスキーを設定してください */
14 const char* ecrobot::ETBluetoothString::PASS_KEY = "1234";
16 const char ecrobot::ETBluetoothString::CMD_START = '1';
18 const char ecrobot::ETBluetoothString::CMD_STOP = '9';
20 bool ETUtilityStuff::IsBluetoothReceived(char cmd)
23 /* Bluetooth通信用データ受信バッファ */
24 char rx_buf[BT_MAX_RX_BUF_SIZE];
26 unsigned char come = 0;
28 for (i=0; i<BT_MAX_RX_BUF_SIZE; i++)
30 rx_buf[i] = 0; /* 受信バッファをクリア */
33 rx_len = ecrobot_read_bt(rx_buf, 0, BT_MAX_RX_BUF_SIZE);
39 come = 1; /* コマンド受信 */
41 ecrobot_send_bt(rx_buf, 0, rx_len); /* 受信データをエコーバック */
47 bool ETUtilityStuff::Istouched(ecrobot::TouchSensor& touch,ecrobot::ETTailControl& tailcontroler)
49 tailcontroler.Control();
50 if(touch.isPressed()){
52 while(touch.isPressed()){
53 tailcontroler.Control();
61 void ETUtilityStuff::Waitstart(ecrobot::TouchSensor& touch,ecrobot::ETTailControl& tailcontroler,char cmd)
63 /* タッチセンサが押されるまで、待ち続ける */
65 if (Istouched(touch,tailcontroler)){
68 if (IsBluetoothReceived(ETBluetoothString::CMD_START)){
74 void ETUtilityStuff::DisplayCalibResult(Lcd& lcd,
77 const unsigned long offset,
79 const unsigned long y)
82 tsprintf(str,disp,offset);
86 speaker.playTone(tone,100,50);