Руслан Урядинский / Mbed 2 deprecated Servo_first

Dependencies:   mbed-STM32F103C8T6 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "stm32f103c8t6.h"
00003 #define position 0.05
00004 
00005 PwmOut Servo(PA_8);
00006 
00007 int main() {
00008     confSysClock();
00009     Servo.period_ms(20);
00010     
00011     while(1) {
00012         Servo = position * 0.545; // max right
00013         wait_ms(1000);
00014         Servo = position * 1.5;  //center
00015         wait_ms(1000);
00016         Servo = position * 2.6;  //max left
00017         wait_ms(1000);
00018     }
00019 }