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

MPU9250 with PWM logic

Hello friends,

i am new to embedded programming and trying to learn the new things in embedded for this i am doing 1 project in which i am using mpu9250 with pwm.

is it possible to glow 4 different LEDs using single pwm module having four channels and how it can work at same time for same duty cycle.

i am also using mpu9250 for accelerometer values, how can i change this like if change in x direction then only 1 LED will glow and if change in y direction then different LED will glow.

i was trying by manipulating examples but only one LED is glowing. how can i implement this with proper logic.

please help me with this

thank you

Parents
  • Hey Rahul. Just got an example working where I am using one pwm instance to increase the duty cycle of the four different leds on the nrf52 dk. Every 10 ms, the LED duty cycle increases by 1% up to 100%. Then, it starts from the beginning I believe. It was based on this simple example (pwm_simple.zip) I found in another devzone case. I've uploaded the source code below if you don't want to give it a try yourself ;)

    But if I were you, I would try to start from the pwm_simple.zip example found in the other devzone case and see if you can figure it out yourself. That way, you'll learn more than just by looking at the answer below. Up to you. :)

    Update: Source Code for nrf52832

Reply
  • Hey Rahul. Just got an example working where I am using one pwm instance to increase the duty cycle of the four different leds on the nrf52 dk. Every 10 ms, the LED duty cycle increases by 1% up to 100%. Then, it starts from the beginning I believe. It was based on this simple example (pwm_simple.zip) I found in another devzone case. I've uploaded the source code below if you don't want to give it a try yourself ;)

    But if I were you, I would try to start from the pwm_simple.zip example found in the other devzone case and see if you can figure it out yourself. That way, you'll learn more than just by looking at the answer below. Up to you. :)

    Update: Source Code for nrf52832

Children
Related