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: adc52832_common mbed
main.cpp
00001 /* 00002 * 00003 * This simple example is to demonstrare usage of pwm driver made by Jurica Reseta 00004 * @ aconno 00005 * jurica_resetar@yahoo.com 00006 * aconno.de 00007 * All right reserved 00008 * 00009 */ 00010 00011 #include "mbed.h" 00012 #include "acd52832_bsp.h" 00013 00014 #define USE_PWMOUT (1) 00015 00016 #if USE_PWMOUT 00017 PwmOut led(PIN_LED); 00018 #endif 00019 00020 int main(){ 00021 uint8_t counter; 00022 float value = 0.0; 00023 float step = 0.025; 00024 00025 #if !USE_PWMOUT 00026 NRF_PWM0->PSEL.OUT[0] = ((1<<31) || 26) ; 00027 NRF_PWM0->ENABLE = 1; 00028 NRF_PWM0->MODE = 0; // Up counting 00029 NRF_PWM0 00030 #endif 00031 00032 #if USE_PWMOUT 00033 led.period(0.0001); 00034 led.write(1.0); 00035 #endif 00036 00037 while(1){ 00038 for(counter=0; counter < uint8_t((1.0/step)); counter++){ 00039 led.write(value); 00040 value += step; 00041 wait_ms(25); 00042 } 00043 if(value>1.0) value=0.0; 00044 led.write(value); 00045 } 00046 }
Generated on Sun Sep 18 2022 01:26:16 by
1.7.2