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.
Dependencies: BLE_API nRF51822 mbed
Fork of KS7 by
Diff: main.cpp
- Revision:
- 17:994c1f037198
- Parent:
- 16:fc66feb533d0
- Child:
- 18:d1d15ec580fa
--- a/main.cpp Thu Dec 17 23:48:23 2015 +0000
+++ b/main.cpp Fri Dec 18 11:44:55 2015 +0000
@@ -90,8 +90,9 @@
GattCharacteristic *DISChars[] = {&ManuName, &ModelNum, &SerialNum, &FWVersion};
GattService DIS(GattService::UUID_DEVICE_INFORMATION_SERVICE , DISChars, sizeof(DISChars) / sizeof(GattCharacteristic *));
-/* to confirm joystick */
+// to confirm joystick
bool check_joystick(){
+/*
float sum_data = 0;
// ジョイスティックXのADC値(0〜1.0換算)が0.5以上ならON、0.5未満ならOFF
@@ -106,6 +107,8 @@
}
return ((sum_data / SW_SAMPLECOUNT) >= SW_THRESHOLD);
+*/
+ return(io.get_switch());
}
uint32_t quick_ieee11073_from_float(float data)
@@ -224,6 +227,7 @@
t.stop();
}
+ io.analog_pow(1);
// ticker処理
switch(led_mode){
case MODE_OFF:
@@ -251,7 +255,8 @@
ble.stopAdvertising();
}
}else{
- weight = io.get_weight() / WEIGHT_COEFFICIENT;
+ weight = io.get_weight_raw() / WEIGHT_COEFFICIENT;
+// pc.printf("w=%f\r\n", weight);
if(weight < 0){
weight = 0;
}
@@ -274,6 +279,7 @@
}
break;
}
+ io.analog_pow(0);
}
}
