bChange

Dependencies:   TextLCD

Revision:
1:60e68d110d01
Parent:
0:18811ba92e94
Child:
2:dbb39def2b89
--- a/main.cpp	Mon Jul 27 05:07:14 2020 +0000
+++ b/main.cpp	Mon Jul 27 06:41:27 2020 +0000
@@ -13,11 +13,14 @@
 
 int b = 0;
 AnalogIn battery(p15);
-
-void change(){
+Serial pc(USBTX, USBRX); // USBシリアルポートのインスタンス
+double test;
+void change(void const *argument){
         while(true){
             //lcd.setBacklight(TextLCD::LightOn);
-            b = (int)((i - MIN_V)/0.107 + 0.5)*10;
+            test = battery.read()*MAX_V;
+            b = (int)((test - MIN_V)/0.107 + 0.5)*10;
+            pc.printf("%f\r\n",test);
             lcd.locate(0,0);
             lcd.printf("Battery:%3d%%",b);
             thread_sleep_for(200);
@@ -42,11 +45,17 @@
 
 }
 
+/*void change(){
+    
+}*/
+
 int main()
 {
-    //Thread thread(change,NULL,osPriorityNormal);
-    Thread thread;
-    thread.start(change);
+    Thread thread(change,NULL,osPriorityNormal);
+    //Thread thread;
+    //thread.start(change);
+    thread.terminate();
+    thread.start(mbed::Callback<void()>(change));
 
     while (true) {
         wait(1);