lab 2 part 4

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
m162568
Date:
Wed Sep 03 19:49:04 2014 +0000
Commit message:
lab 2 part4

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 03 19:49:04 2014 +0000
@@ -0,0 +1,16 @@
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+
+int main() {
+    float brightness;   //initializes variable
+    pc.baud(921600);    //set the baud rate to 921600
+    PwmOut light(LED1); // creates a PWMout named light on LED1. 
+                        // will be able to change the brightness of the light using the PWM
+    printf("Type the desired brightness from 0.0 t o 1.0\n"); //prompts the user
+    scanf("%f",&brightness);                                  //reads in value typed.
+    printf("%f is the brightness", brightness);              
+    light.write(brightness);                 //sets the value of light to variable brightness
+    
+    
+    }
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Wed Sep 03 19:49:04 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013
\ No newline at end of file