Python-on-a-Chip (p14p)

pymite_mbed_r514

Python-on-a-Chip, or p14p for short, is a project to combine the PyMite VM (a flyweight implementation of the Python language for microcontrollers) with a library to control the microcontroller's peripherals.  P14p has been ported to the mbed and some, but not all, of the peripheral API has been wrapped.  The following table depicts the programming interface available in p14p on the mbed:

Class Methods
AnalogIn AnalogIn(n)
read_u16(self,)
read(self,)
AnalogOut AnalogOut(n)
write_u16(self, n)
write(self, n)
read(self,)
DigitalIn DigitalIn(n)
read(self,)
DigitalOut DigitalOut(n)
read(self,)
write(self, n)
PwmOut PwmOut(n)
read(self,)
period(self, t)
period_ms(self, t)
period_us(self, t)
pulsewidth(self, n)
pulsewidth_ms(self, n)
pulsewidth_us(self, n)
Serial Serial(tx, rx)
putc(self, s)
puts(self, s)
getc(self,)
SPI SPI(mosi, miso, sclk)
format(self, bits, mode=0)
frequency(self, hz)
write(self, v)
I2C I2C(sda, scl)
frequency(self, hz)
read(self, addr, data, length)
write(self, addr, data, length)
TextLCD TextLCD()
printf(self, n)
cls(self,)
locate(self, column, row)


3 comments

15 Jul 2010

Dean,

Do you have a step by step demo of using the API on the mbed?

Thanks,

Pat

28 Feb 2011
ipm doesn't work now - from pymite ML
08 Mar 2011

The old pymite cookbook page shows some step-by-step.  Ignore the how-to-build section, it's out of date and I can't update the cookbook anymore.  But scroll down and you can see example interactive

I just tested p14p on mbed using the latest from the repository and it works.  Our discussion will continue on the p14p mailing list (I don't check mbed forums very often).

You need to log in to post a comment