Joel Jacob
/
Maglev
hi
Revision 1:2cbf78bc187c, committed 2015-02-06
- Comitter:
- Y0Q
- Date:
- Fri Feb 06 08:59:48 2015 +0000
- Parent:
- 0:5f48ee97957e
- Commit message:
- secon
Changed in this revision
Compare.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5f48ee97957e -r 2cbf78bc187c Compare.cpp --- a/Compare.cpp Thu Feb 05 10:08:40 2015 +0000 +++ b/Compare.cpp Fri Feb 06 08:59:48 2015 +0000 @@ -1,5 +1,5 @@ #include "mbed.h" - +//#include "analogin.h" AnalogIn ain(p20); DigitalOut led(LED1); PwmOut outy(p21); @@ -10,18 +10,24 @@ { while (1) { - pc.printf("analog in = %f\n", ain.read_u16()); - if(ain > 0.96) { - led = 1; - } else { - led = 0; - } - + float value=ain.read(); -//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 + //printf("analog original = %f\n", ain.read()); + pc.printf("analog in = %f\n", value); + if(value > 0.96) + { + //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) + led = 1; + + } + else { + led = 0; + outy.period(0.0); // 4 second period + outy.pulsewidth(0.0); // 2 second pulse (on) + } + + } } -}