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.
main.cpp
- Committer:
- justinkim
- Date:
- 2016-04-01
- Revision:
- 0:442f18a546fc
- Child:
- 1:8cd390425e1f
File content as of revision 0:442f18a546fc:
/** ****************************************************************************** * @project Servo Motor example * @author Justin Kim * @version V1.0.0 * @date 01-APR-2016 * @brief Main program body ******************************************************************************* **/ /* Includes ------------------------------------------------------------------*/ #include "mbed.h" #include "Servo.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ Serial pc(USBTX, USBRX); Servo myservo(PC_4); /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Main Function * @param None * @retval None */ int main(void) { char ch; bt.baud(115200); pc.printf("Hello World!\n\r"); while(1) { if(pc.readable()) { ch=pc.getc(); pc.printf("%c",ch); if(ch == '*') { myservo = 0.5; } else if(ch == '+') { myservo = myservo + 0.1; } else if(ch == '-') { myservo = myservo - 0.1; } } } }