step 3
Dependencies: mbed
main.cpp
- Committer:
- LanierUSNA16
- Date:
- 2014-09-04
- Revision:
- 0:dc588b6743b2
File content as of revision 0:dc588b6743b2:
#include "mbed.h" //Lab 2, step 3 //code given by professor Serial pc(USBTX, USBRX); //establish pwmout on pin 21 PwmOut pwmbright(p21) int main() {//begin main //set the duty cycle duty_cycle=0.5; //set the period period = 0.1; while (1) { //set computer sampling rate pc.baud(921600); //set the pwm duty cycle coming off pin 21 pwmbright.write(duty_cycle); //set the pwm period coming off pin 21 pwmbright.period(period); //wait 1 second before reiterating wait(1); }//end while }//end main