Joel Jacob
/
Maglev
hi
Diff: Compare.cpp
- Revision:
- 0:5f48ee97957e
- Child:
- 1:2cbf78bc187c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Compare.cpp Thu Feb 05 10:08:40 2015 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" + +AnalogIn ain(p20); +DigitalOut led(LED1); +PwmOut outy(p21); +Serial pc (USBTX,USBRX); +int main() + +//Analog Hall sensor input +{ + while (1) { + + pc.printf("analog in = %f\n", ain.read_u16()); + if(ain > 0.96) { + led = 1; + } else { + led = 0; + } + + +//PWm wave jugaaad ka output!! +// specify period first, then everything else +outy.period(0.00090); // 4 second period +outy.pulsewidth(0.00081); // 2 second pulse (on) +//while(1); // led flashing +} +}