bChange
Dependencies: TextLCD
Diff: main.cpp
- Revision:
- 7:3fc517224e66
- Parent:
- 6:1545ad4c64e6
- Child:
- 8:0719ca2421b4
--- a/main.cpp Wed Jul 29 01:12:14 2020 +0000 +++ b/main.cpp Wed Jul 29 02:24:28 2020 +0000 @@ -26,14 +26,18 @@ } flag_b = !flag_b; } -void change(){ +void bChange(){ lcd.setBacklight(TextLCD::LightOn); while(true){ - b = (int)((battery.read()* MAX_V - MIN_V)/0.067 + 0.5)*10; + double test = battery.read(); + b = (int)(((test* 3.3 - MIN_V)/0.67)*10+0.5)*10; + //b = (int)(((test*3.3 - MIN_V))/(MAX_V) + 0.5)*10; + pc.printf("test*3.3=%f,b = %d\r\n",test*3.3,b); if(b < 0){//すべての機能停止 - lcd.setBacklight(TextLCD::LightOff); + /*lcd.setBacklight(TextLCD::LightOff); bTimer.stop(); - exit(1); + exit(1);*/ + b = 0; }else if(b > 100){ b = 100; } @@ -73,7 +77,7 @@ } -/*void change(){ +/*void bChange{ }*/ @@ -81,7 +85,7 @@ { //Thread thread(change,NULL,osPriorityNormal); Thread thread; - thread.start(change); + thread.start(bChange); while (true) { wait(1); }