Report
4 years, 5 months ago.

How to use Python or C on mbed (LPC 1768) instead of c++

Hi - I'd like to use a python script for PWM generation on the LPC1768.

Could someone provide a basic example?

Thanks

Comment on this question

4 Answers

4 years, 5 months ago.

There is no python interpreter that works to develop for mbed.

You have to use c...

Any available examples for using C(not C++)? Ideally one for PWM generation..

posted by Tron Tronian 16 Apr 2015

c is (mostly) a subset of c++. So while mbed is inherently c++ you can write pure c code an it'll run fine.

As for how to use a PWM output, the PWM out hello world example is a good starting point. http://developer.mbed.org/teams/mbed_example/code/PwmOut_HelloWorld/

posted by Andy A 17 Apr 2015
4 years, 5 months ago.

You may take a look at : https://micropython.org/ It's a Python 3.4 running on a STM32F4xx (not a LPC1768 (it may run on a LPC1768 but the lack of RAM drive it quickly to be useless)).

At this time MicroPython runs on the PyBoard baord but also on a STM32F4Discovery or on the Seeed Studio Arch Max. It's an open source project and you could easily adapt it to your needs.

Thanks Patrick, I've checked out micropython previously and it does not have analog out/pwm gen. Though it has lots of other cool features

posted by Tron Tronian 16 Apr 2015

Of course Micropython has both DAC and PWM ! Perhaps could you check it a little more :-)

posted by Patrick Pollet 16 Apr 2015

You are correct. Micropython can do it all

posted by Tron Tronian 16 Apr 2015
-deleted-
4 years, 5 months ago.

Haven't tried it but have a look at pymite here http://developer.mbed.org/users/va009039/code/pymite/.


You need to log in to post a question