h

Dependencies:   mbed

Fork of HelloWorld by judo ~

main.cpp

Committer:
oopakhooo
Date:
2016-11-16
Revision:
5:afabac4fce1b
Parent:
4:f0a11480f39f

File content as of revision 5:afabac4fce1b:

#include "mbed.h"
#include "PaceHeart.h"
#include "Hardware.h"

//DigitalOut output_pin_A(LED1);

PaceHeart* Pacer = new PaceHeart();
DigitalOut led(LED1);
Serial pc(USBTX, USBRX);
void baud(int baudrate) {
    
    pc.baud(baudrate);
}
    

int main() {
    baud(57600);
    while(1){
    Check_serial(pc,*Pacer);
    }
   
    /*
        
        AnalogOut aout(p18);  //sets up pin 18 as an analogue output
        AnalogueIn ain(p15);  //sets up pin 15 and an analogue input
 
        int main(){
             aout=0.5;  //sets output to 0.5*VCC
            while(1){    //sets up a loop
             if (ain>0.3){   //tests whether the input is above 0.3
            aout=0;  //sets the output to 0
      }
      aout = 0.5;
      wait(1);
      aout = 0;
      
      
      
   }
   
           sine wave output
           const double pi = 3.141592653589793238462;
            const double amplitude = 0.5f;
            const double offset = 65535/2;
            double rads = 0.0;
            uint16_t sample = 0;
            
            while(1) {
                // sinewave output
                for (int i = 0; i < 360; i++) {
                    rads = (pi * i) / 180.0f;
                    sample = (uint16_t)(amplitude * (offset * (cos(rads + pi))) + offset);
                    aout.write_u16(sample);
                }
            }
    */
}