#include "mbed.h" AnalogIn LM35(PTB0); AnalogIn POT(PTB1); DigitalIn botao(PTA4); DigitalOut dir_1(PTA13); DigitalOut dir_2(PTD5); DigitalOut led(LED_GREEN); DigitalOut rele(PTA12); PwmOut fan(PTD4); Serial PC(USBTX, USBRX); int main() { int last_botao=0, Acao=0; float Temp=0.0, Ref = 0.0; dir_1=1; dir_2=0; //Direção da ponte H fan=0.0; fan.period(0.0001); led=1; rele=1; Acao = !led; while(1) { Ref = 15*POT+35; //Referencia varia de 35oC a 50oC ao variar o POT Temp=LM35*330.0; //Converte leitura para oC if(botao == 1 && last_botao == 0) { fan = !fan; Acao = !Acao; led = !Acao; } last_botao = botao; PC.printf("%d \t %2.1f \t %2.1f\r\n", Acao, Ref, Temp); wait(0.2); } }