BatteryPanel_Funcional
Dependencies: BatteryPanel mbed
Revision 0:d996ece0ce3f, committed 2019-06-04
- Comitter:
- williequesada
- Date:
- Tue Jun 04 19:26:20 2019 +0000
- Commit message:
- pablo
Changed in this revision
diff -r 000000000000 -r d996ece0ce3f BatteryPanel.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BatteryPanel.lib Tue Jun 04 19:26:20 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/williequesada/code/BatteryPanel/#c8cdb6bdc59d
diff -r 000000000000 -r d996ece0ce3f main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 04 19:26:20 2019 +0000 @@ -0,0 +1,80 @@ +#include "mbed.h" +#include "BatteryPanel.h" + +BATTERY_PANEL Charger(PF_9, PF_7, PG_1); + +DigitalOut led1(PB_7); +DigitalOut led2(PB_14); +DigitalOut led3(PC_7); + +DigitalOut PW1(PF_3); +DigitalOut PW2(PC_2); + +Serial Computer(USBTX, USBRX); + +DigitalOut Regulator5V(PA_1); + +void Leds(){ + led1=0; + led2=0; + led3=0; + led1=1; + Computer.printf("led1\n\n"); + wait(5); + led1=0; + led2=1; + Computer.printf("led2\n\n"); + wait(5); + led2=0; + led3=1; + Computer.printf("led3\n\n"); + wait(5); + led3=0; +} + +int main() +{ + float Lectura; + int Lectura1; + PW1=0; + PW2=0; + + Computer.printf("\nAnalog input test\n"); + + while(1) { + + Lectura = Charger.BatteryRead(); // Read the analog input value (value from 0.0 to 1.0 = full ADC conversion range) + printf("Lectura = %.3f -----Bateria\n",Lectura); + Lectura = Charger.BatteryAnalog(); // Read the analog input value (value from 0.0 to 1.0 = full ADC conversion range) + printf("Lectura = %.3f -----Bateria\n",Lectura); + //printf("%.3f, %.2f V,%.2f ->Bat\n",ValorLectura,ValorCalculado,ValorReal); + + if(Lectura>15){ + led1=1; + } else { + led1=0; + } + if(Lectura<12){ + led2=1; + } else { + led2=0; + } + + Lectura = Charger.PanelRead(); + printf("Lectura = %.3f -----Solar Panel\n",Lectura); + Lectura = Charger.PanelAnalog(); + printf("Lectura = %.3f -----Solar Panel\n",Lectura); + + Lectura1 = Charger.Control(); + printf("Estado = %i \n\n",Lectura1); + wait(1); // 1 second + + printf("on\n"); + Charger.ControlOn(); + wait(10); + printf("off\n"); + Charger.ControlOff(); + wait(10); + + } +} \ No newline at end of file
diff -r 000000000000 -r d996ece0ce3f mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jun 04 19:26:20 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/5aab5a7997ee \ No newline at end of file