
Régulateur de type proportionnel
Revision 0:cabc061cb9e7, committed 2018-12-18
- Comitter:
- Bleiz038
- Date:
- Tue Dec 18 19:16:30 2018 +0000
- Commit message:
- d
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/C12832.lib Tue Dec 18 19:16:30 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/users/chris/code/C12832/#7de323fa46fe
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 18 19:16:30 2018 +0000 @@ -0,0 +1,49 @@ +#include "mbed.h" +#include "C12832.h" +C12832 lcd(p5,p7,p6,p8,p11); +AnalogIn Vcapt(p17); +AnalogOut Vcde(p18); +AnalogIn p1(p19); +Ticker cadence; +float E; +int Tc = 35; +float T; +float K=1; +Serial pc(USBTX, USBRX); +char x; + +void regulation() { + T=330*Vcapt; + E=Tc-T; + Vcde=K*E; + if(Vcde>1){ + Vcde=1; + } + if(Vcde<0){ + Vcde=0; + } +} + +int main(){ + cadence.attach(®ulation,0.001); + while (1){ + if (pc.readable()){ + x= pc.getc(); + if (x=='p'){ + Tc++; + } + if (x=='m'){ + Tc--; + } + } + K = 0.1; + lcd.cls(); + lcd.locate(0,0); + lcd.printf("Temprature : %4.3f",T); + lcd.locate(0,8); + lcd.printf("Tc : %d",Tc); + lcd.locate(0,16); + lcd.printf("K : %4.2f",K); + wait(0.1); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Dec 18 19:16:30 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file