Rebecca Greenberg
/
lab2_part4
lab 2 part 4
Diff: main.cpp
- Revision:
- 0:7e7206bbc34c
--- /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