Dragon50

Python equivalent to scratch calibration block

Recommended Posts

My current project uses "run_to_position(0, direction='shortest path')" to set two motors to a known position before the rest of the code runs. However, this doesn't always work. If I run another of my creations, usually by mistake, before running my current project the motors can end up in some odd position and running code that begins with "run_to_position(0, direction='shortest path')" does not correct the situation.

I can correct this either by switching the hub off and then back on and select the correct programme or run the Charlie scratch version provided by Lego. The scratch code contains a "calibration block". I'm attempting to simulate that block by running "run_to_position(0, direction='shortest path')". It seems that the block contains more that run_to_position and that I need a piece of Python code that is the equivalent of the "calibration block. Can anyone offer any suggestions?

 

Edited by Dragon50
Spelling error

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

  • Recently Browsing   0 members

    No registered users viewing this page.