Vincent Cheung
/
HelloWorld
h
Fork of HelloWorld by
Diff: main.cpp
- Revision:
- 5:afabac4fce1b
- Parent:
- 4:f0a11480f39f
--- a/main.cpp Mon Nov 14 19:59:54 2016 +0000 +++ b/main.cpp Wed Nov 16 21:44:03 2016 +0000 @@ -1,49 +1,25 @@ #include "mbed.h" #include "PaceHeart.h" +#include "Hardware.h" //DigitalOut output_pin_A(LED1); -PaceHeart* Pacer = new PaceHeart; +PaceHeart* Pacer = new PaceHeart(); DigitalOut led(LED1); -Serial s(USBTX, USBRX); +Serial pc(USBTX, USBRX); void baud(int baudrate) { - s.baud(baudrate); + pc.baud(baudrate); } int main() { + baud(57600); + while(1){ + Check_serial(pc,*Pacer); + } + /* - baud(57600); - s.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n"); - while(1) { - char c = s.getc(); - pc.putc(pc.getc()); //echoes back input - if((c == 'u')) { - - led = !led; - } - if((c == 'd')) { - led = 0; - } - }*/ - Pacer-> pace_A(); - /* PwmOut out(PTA0); pulse width thingy - PwmIn in(PTD1); - float pe,pw,ds; - - // set the PwmOut in seconds - out.pulsewidth(2); - out.period(4); - - while (true) { - pe= in.period(); - pw= in.pulsewidth(); - ds= in.dutycycle(); - pc.printf("A period= %f, pulsewidth= %f, duty cycle= %f\n\r",pe, pw, ds); - - wait(1); - } AnalogOut aout(p18); //sets up pin 18 as an analogue output AnalogueIn ain(p15); //sets up pin 15 and an analogue input @@ -58,6 +34,8 @@ wait(1); aout = 0; + + } sine wave output