justin kim
/
PWM_OUTPUT_SERVO_W7500ECO
PWM_OUTPUT_SERVO_W7500ECO
main.cpp
- Committer:
- justinkim
- Date:
- 2016-04-01
- Revision:
- 1:8cd390425e1f
- Parent:
- 0:442f18a546fc
File content as of revision 1:8cd390425e1f:
/** ****************************************************************************** * @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; pc.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; } } } }