by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp
00001 /*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope. 00002 */ 00003 #include "mbed.h" 00004 PwmOut PWM1(p21); //create a PWM output called PWM1 on pin 21 00005 int main() 00006 { 00007 PWM1.period(0.010); // set PWM period to 10 ms 00008 PWM1=0.5; // set duty cycle to 50% 00009 } 00010
Generated on Sun Jul 17 2022 00:39:52 by 1.7.2