step 3
Dependencies: mbed
Revision 0:dc588b6743b2, committed 2014-09-04
- Comitter:
- LanierUSNA16
- Date:
- Thu Sep 04 03:05:43 2014 +0000
- Commit message:
- step 3;
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 Thu Sep 04 03:05:43 2014 +0000 @@ -0,0 +1,31 @@ +#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 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 04 03:05:43 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9327015d4013 \ No newline at end of file