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? 


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. 





Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...