Rebecca Greenberg
/
lab2_part3
lab 2 part3
main.cpp@0:cd962a5cfa8d, 2014-09-03 (annotated)
- Committer:
- m162568
- Date:
- Wed Sep 03 19:48:46 2014 +0000
- Revision:
- 0:cd962a5cfa8d
lab2 part3;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
m162568 | 0:cd962a5cfa8d | 1 | #include "mbed.h" |
m162568 | 0:cd962a5cfa8d | 2 | |
m162568 | 0:cd962a5cfa8d | 3 | Serial pc(USBTX, USBRX); |
m162568 | 0:cd962a5cfa8d | 4 | |
m162568 | 0:cd962a5cfa8d | 5 | int main() { |
m162568 | 0:cd962a5cfa8d | 6 | |
m162568 | 0:cd962a5cfa8d | 7 | pc.baud(921600); //set the baud rate to 921600 |
m162568 | 0:cd962a5cfa8d | 8 | PwmOut pulse(p21); //creates a PWMout on pin21 named pulse |
m162568 | 0:cd962a5cfa8d | 9 | pulse.write(.5); //sets the value of pulse. Can only have values between 0.0 and 1.0 |
m162568 | 0:cd962a5cfa8d | 10 | pulse.period(.010); // sets the period of the pulse |
m162568 | 0:cd962a5cfa8d | 11 | |
m162568 | 0:cd962a5cfa8d | 12 | |
m162568 | 0:cd962a5cfa8d | 13 | |
m162568 | 0:cd962a5cfa8d | 14 | } |