ev3dev / ev3dev-lang-python-demo

Python Demo Programs
MIT License
60 stars 28 forks source link

Create example scripts for the EDUCATOR robot #13

Closed gregcowell closed 6 years ago

gregcowell commented 6 years ago

This addresses issue #2. These are just simple demonstration scripts that use the new high level API. I'd like to create a more challenging script later (maze solver).

gregcowell commented 6 years ago

I've made the required changes except for the import. When I change:

from ev3dev.sensor.lego import ColorSensor

to:

from ev3dev.sensor import ColorSensor

the import fails.

Is a change required to sensor/__init__.py to make this work as intended ?

WasabiFan commented 6 years ago

Is a change required to sensor/init.py to make this work as intended ?

@dwalton can we rearrange things? I don't think that having a lego module is useful; it would make more sense to me to either put them all into one file or put each into its own and re-export them in the init file.

dlech commented 6 years ago

can we rearrange things? I don't think that having a lego module is useful;

It may not make sense now, but if we make specialized classes for the dozens of 3rd party sensors, the it will be nice to have a bit more organization.

For example, in this case, we have the ColorSensor class. But how do you know if this is the LEGO EV3 color sensor, the LEGO NXT color sensor or the HiTechnic v1 color sensor or the HiTechnic v2 color sensor?

gregcowell commented 6 years ago

I've made all the required changes to the scripts.

dwalton76 commented 6 years ago

Greg any interest in updating the demo for BALANCER?

gregcowell commented 6 years ago

Greg any interest in updating the demo for BALANCER?

Yep, I'm happy to do that.

dwalton76 commented 6 years ago

Awesome thank you :)