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-STM32F103C8T6 mbed
main.cpp
- Committer:
- RuslanUrya
- Date:
- 2018-04-10
- Revision:
- 4:2196462a17f5
- Parent:
- 3:ca6028700d1a
- Child:
- 5:e86eda00ef3f
File content as of revision 4:2196462a17f5:
#include "mbed.h" #include "stm32f103c8t6.h" #define val 0.05 // percents in step / 100 PwmOut Servo (PC_13); Ticker timer; double f; int i = 0; void sinus (){ f = (sin((double)i) + 1.0) / 2 + 1; //1..2 i++; if (i > 360) i = 0; Servo = (float)f * val; } int main() { confSysClock(); Servo.period_ms(20); timer.attach(&sinus, 1 / 360); //sine period, sec while(1) { // duty-cycle, perсents 0..1; } }