Christina Lanier
/
MBED_lab1_Step4
step 4
step4.cpp
- Committer:
- LanierUSNA16
- Date:
- 2014-09-04
- Revision:
- 0:7120409e3f94
File content as of revision 0:7120409e3f94:
#include "mbed.h" //Lab 2, step 4 //code given by professor Serial pc(USBTX, USBRX); //establish pwmout on LED1 PwmOut pwmled(LED1); int main() {//begin main //create dutycycle variable float dutycycle=0.0; while (1) { //computer sampling rate pc.baud(921600); //prompt the user to enter the desired duty cycle, i.e. brightness of light printf("Enter \n "); //assign user input to variable 'dutycycle' scanf("%f", &dutycycle); //set the dutycle, i.e. brightness, to the user input pwmled.write(dutycycle); //wait 1 second before reiterating wait(1); }//end while }//end main