ss

Dependencies:   MotionSensor mbed

Fork of Assignment2_ver2 by weeb grammers

Revision:
7:6dc42e1a2a81
Parent:
4:f0a11480f39f
--- a/main.cpp	Mon Nov 14 22:47:00 2016 +0000
+++ b/main.cpp	Tue Nov 29 20:21:45 2016 +0000
@@ -1,79 +1,21 @@
 #include "mbed.h"
 #include "PaceHeart.h"
-
+#include "Hardware.h"
 //DigitalOut output_pin_A(LED1);
 
 PaceHeart* Pacer = new PaceHeart;
 DigitalOut led(LED1);
-Serial s(USBTX, USBRX);
-void baud(int baudrate) {
-    
-    s.baud(baudrate);
+Serial pc(USBTX, USBRX);
+void setup() {
+    pc.baud(57600);
 }
     
 
 int main() {
-    /*
-    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
- 
-        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);
-                }
-            }
-    */
+    setup();
+    while(1){
+    Output_V(1.0,0.4);
+    //Check_serial(pc,*Pacer);
+    }
+    //Pacer-> pace_A();
 }