Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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