Jump to content

"undefined reference" in example file Lux1.mpy

Recommended Posts

I had great luck with my first Mpy app using this style example code.


pulse_period(0, period)
pulse_width(0, width)
My second attempt at PWM stuff didn't work, so I looked for more examples, like "lux1.mpy" which seemed to be a great example for what I needed.
But, except for:

 all other lines result in "undefined reference" when trying to compile.


I don't understand how/where these included files come from, or why these examples don't work.


Can anyone shed some light on how to get "lux1.mpy" to work? 


Share this post

Link to post
Share on other sites

Sorry you ran into this problem. The 'lux1.mpy' file is an obsolete example, it uses a number of commands that have now been replaced.

It should not have been included in the examples directory.


All the mpy commands starting with 'pwm_' have been replaced by the 'pulse_' commands.

All the commands starting with 'dir' are replaced with 'pindir'.

The define_micro command is also redundant.

This would explain the many undefined references you had.


To see all the available commands click on the Help button on the bottom window of the mpyEditor, and then click on the 'mpy Programming Language' link.

The 'getting started with mpy' link is also very useful.

Or you can go to  http://www.mpyprojects.com/software/mpy-language/


mpy does not need any include files. All the special IO commands are included automatically by the mpy compiler.


I just checked the examples directory. The examples which are dated later than September 2012 should work.


Hope this helps. Please let me know if you still have a problem, or if there is some function in lux1.mpy

that you need to get working. 





Share this post

Link to post
Share on other sites

thanks for the quick response!  that helps.  I'll continue to figure out the 'pulse..' commands for new stuff.

regarding new parts - will this recognize/program my projects built with the msp430g2233?



Share this post

Link to post
Share on other sites

Sorry, only the  MSP430 chips supplied with the Launchpad are currently supported by the mpyEditor.


I'll take a closer look at the code to see if there is a workaround to allow the other chips to be used. 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now