![](/media/cache/group/Display_Nokia_Insper_v01.jpg.50x50_q85.jpg)
12/mar ignicao funcionando
Dependencies: mbed reScale TextLCD
main.cpp
- Committer:
- Marcelocostanzo
- Date:
- 2018-04-25
- Revision:
- 2:3c69c0772709
- Parent:
- 0:b5a9e0614efd
- Child:
- 3:9d22aa32b223
File content as of revision 2:3c69c0772709:
#include "mbed.h" InterruptIn motora(D0); InterruptIn movida(D1); DigitalOut ign(LED1); Timer tbase; Ticker call; Serial pc(USBTX, USBRX); // tx, rx unsigned long int t_motora, t_movida; void tracao() { tbase.stop(); t_motora = tbase.read_us(); tbase.reset(); tbase.start(); } void livre() { tbase.stop(); t_movida = tbase.read_us(); tbase.reset(); tbase.start(); } void send() { pc.printf("Tempo: %.3f Hz \n\r"); } int main() { motora.fall(&tracao); // attach the address of the measure function to the rising edge movida.fall(&livre); // attach the address of the measure function to the rising edge //call.attach(&send, 0.5); while(1) { if(t_movida < t_motora) { ign=0; wait(0.1); } else { ign=1; } } }