bluatigro

some python for 51515

Recommended Posts

	hub = MSHub()
	mp = MotorPair( 'A' , 'B' )
	mp.set_default_spped( 50 )
	mp.move( 2 , "rotations' , steering = 0 )
	#roations can also be degrees or seconds
	
Edited by bluatigro

Share this post


Link to post
Share on other sites

	#create objects
	dist = DistanceSensor( 'E' )
	color = ColorSensor( 'F' )
	#read examples
	darkness = color.get_reflected_light()
	color.wait_for_color( 'red')  
	dist.wait_for_distance_closer_then( 10 , 'cm' )
	hub.moition_sensor.wait_for_new_gesture( 'tapped' )
	

Share this post


Link to post
Share on other sites

Hi I 'm  not sure what youe are looking for

But yout find lots of descriptions and examples (also transscription from Scratch into python) within the mindstorms software?

You click on the "book"-symbol  on the most right of the screen.

 

Share this post


Link to post
Share on other sites

But you showed some python code here?

Anyway:

In the menu bar you have the home-symbol, an open scratch project and a "+" sign

Click on "+", choose python, then you have a python project and the book symbol.

Share this post


Link to post
Share on other sites
Posted (edited)

I'm currently working on implementing all the 51515 base projects in Python. You can find the code in my GitHub repository. It is work in progress and not all of them are done (far from it - just started with Charlie). However, I plan to keep working on them on my free time. Feel free to take a look around. Feedback is always welcome!

Edited by arturomoncadatorres

Share this post


Link to post
Share on other sites
2 hours ago, arturomoncadatorres said:

I'm currently working on implementing all the 51515 base projects in Python. You can find the code in my GitHub repository. It is work in progress and not all of them are done (far from it - just started with Charlie). However, I plan to keep working on them on my free time. Feel free to take a look around. Feedback is always welcome!

Why don't you just download the example projects to the hub and then upload them back to the computer with a tool like rshell? With the current mindstorms app version, all scratch programs are stored on the hub in plain python text.

Share this post


Link to post
Share on other sites
17 minutes ago, Tcm0 said:

Why don't you just download the example projects to the hub and then upload them back to the computer with a tool like rshell? With the current mindstorms app version, all scratch programs are stored on the hub in plain python text.

That's interesting, I didn't know that. Originally, I was doing this as a learning exercise (and hopefully to make it useful to other people starting with (Micro)Python). Nevertheless, I might look into this in the future. Thanks!

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.