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: FastPWM mbed-STM32F103C8T6 mbed
main.cpp
00001 #include "mbed.h" 00002 #include "stm32f103c8t6.h" 00003 #define DELAY 1.0/180 00004 00005 PwmOut mypwm(PB_6); 00006 00007 00008 int main() { 00009 confSysClock(); 00010 float f; 00011 double i = 0; 00012 mypwm.period(DELAY); // period, sec 00013 00014 while(1) { 00015 f = (((float)sin (i) + 1.0)/2)*100; //sin in percents 0..100 00016 mypwm = f; //duty cycle, percent 00017 i++; 00018 if (i > 180) i = 0; 00019 } 00020 }
Generated on Sat Jul 16 2022 09:30:51 by
1.7.2