This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

PWM control using accelerometer

hello friends,

i need to control 4 LED brightness using PWM according to accelerometer values. how can i do that

i am using SDK11, nrf52832, KEIL MDK5

i going to attach main file what i am doing wrong please check and let me know main.txt

and if possible please let know how can i proceed in right way

Parents
  • No examples uses this, but its very easy to use. Declare the static nrf_pwm_values_individual_t seq_values_new[] at top of main.c, after the includes (You are already doing this in the code you uploaded) .

    Then you can use it like this to update the PWM duty cycle for the channel you want.

    seq_values[0].channel_0 = my_new_value; // New value for channel 0
    
    nrf_pwm_values_t new_pwm_values; 
    
    new_pwm_values.p_individual = seq_values;
    
    nrf_drv_pwm_sequence_values_update(&m_pwm0,1,new_pwm_values);
    
Reply
  • No examples uses this, but its very easy to use. Declare the static nrf_pwm_values_individual_t seq_values_new[] at top of main.c, after the includes (You are already doing this in the code you uploaded) .

    Then you can use it like this to update the PWM duty cycle for the channel you want.

    seq_values[0].channel_0 = my_new_value; // New value for channel 0
    
    nrf_pwm_values_t new_pwm_values; 
    
    new_pwm_values.p_individual = seq_values;
    
    nrf_drv_pwm_sequence_values_update(&m_pwm0,1,new_pwm_values);
    
Children
No Data
Related