Keith Packard has designed an open-hardware python microcontroller for LEGO:
Learn, Teach, Experiment, and Play with Robots
Snekboard is an open hardware development board that’s designed to let you hook up to LEGO Power Functions* motors and switches so you can build robots out of LEGO and control them with CircuitPython or the simpler Snek programming language.
Snekboard is 48 x 48 mm – the same size as 6 x 6 LEGO studs – so you can easily build a LEGO enclosure for the board and attach it to your creation. It is powered by a 3.7 V, 900 mAh single-cell Lithium Polymer (LiPo) battery that fits under the board and charges over USB while Snekboard is being programmed from the host.
Python and LEGO Together at Last
Python is widely regarded as a great first programming language. LEGO products are used in many settings for teaching about robotics. It’s time to bring these amazing learning tools together. Snekboard bridges the two worlds by offering a hardware platform capable of running Python while directly controlling LEGO Power Functions Motors.