7 years, 4 months ago.

Simple PWM..

Unable to simply pwm a pin

Using the mbed handbook examples found here

https://os.mbed.com/handbook/PwmOut

All examples return a error -230 for syntax..

My own simple code..

  1. include "mbed.h"

PwmOut mypwm(D3);

int main() { while(1) { mypwm.period_ms(10); mypwm.pulsewidth_ms(10); } }

Literally nothing is happening, LED connections tested and good, digital out works fine. Viewed on the oscope and no signal. Whats wrong here?

1 Answer

7 years, 4 months ago.

Hi Tyler,

We think you are accidentally using an OS5 example on a board that only supports OS2. Even though this example comes from the OS2 handbook, it appears to have been udpated for OS5. Looking at your account we see that you are likely using the Nucleo-F302R8. This board has a small memory footprint so support for OS5 was not added.

I just recreated this PWM example for OS2 and you can import it into your Online Compiler workspace from here:

Please try building and running this example.

The error message you are getting is obviously misleading. So we have raised a defect to have the error message improved. We apologize for the inconvenience.

-Ralph, Team Mbed

Unfortunately same results. Ill get a board that has has OS5 and give that a shot. Thanks

posted by Tyler Hill 13 Sep 2018