Python-on-a-Chip (p14p)
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
You need to log in to post a comment
Dean,
Do you have a step by step demo of using the API on the mbed?
Thanks,
Pat