Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 1 month ago.
Pwm Output
Hey guys, Need some help with the code, i can't figure it out whats the problem.
"PwmOut my_pwm(PB_3,PB_4,PB_5);" i got used to c programming, and i don't know how to write multiple output ports here. because this one is not working and it gives me an error.
Thank you in advance!
1 Answer
11 years, 1 month ago.
A pwm output only has one pin which is why you can't specify one with 3.
If you want 3 different PWM outputs then you need to declare 3 different pwms. While you could in theory do it all in one line it's more normal to put each one on it's own line.
pwmOut my_pwm1(PB_3); pwmOut my_pwm2(PB_4); pwmOut my_pwm3(PB_5);