pwm recibe la entrada del pid y varia el ciclo de trabajo y = 2.5x - 1.5 presion dice si esta lleno o que se yo (actualizar valores)
Fork of PWM by
main.cpp
- Committer:
- josedaparte
- Date:
- 2015-12-04
- Revision:
- 2:be4ea24f1cdd
- Parent:
- 1:778a662bafcf
- Child:
- 3:7de9f8f4a15e
File content as of revision 2:be4ea24f1cdd:
#include "mbed.h" #include "TextLCD.h" #include "AnalogIn.h" PwmOut pwmsal(PTD2); AnalogIn pwment(PTB1); Serial pc(USBTX,USBRX); float valorpwm; TextLCD lcd(PTD3, PTA12, PTA4, PTA5, PTC8, PTC9, TextLCD::LCD16x2); AnalogIn presionin(PTB3); float caspresion; int main() { while(1){ caspresion = presionin.read() * 3.3; lcd.cls(); lcd.locate(0,1); lcd.printf("%.2f",caspresion); if(caspresion >= 2.34){ lcd.locate(0,0); lcd.printf("maximo"); } if(caspresion >= 1.68 && caspresion <= 1.85){ lcd.locate(0,0); lcd.printf("medio"); } if(caspresion <= 1.03){ lcd.locate(0,0); lcd.printf("minimo"); } pc.baud(115200); pwmsal.period_ms(5); valorpwm = pwment.read(); pwmsal.write(valorpwm); wait(1); } }