p = PwmOut(1) # LED1
p.period_us(1000)
p.pulsewidth_us(500)
Use the integer 1 (one) to access LED1, 2 for LED2 and so on in the constructor of the class as shown in the example above.
!!Dean
By the way, it's interesting the idea of offer a common set of
periferical functions to allow an uniform access. I think a good idea
would be something like a 'devices' package with periferical
objects/modules inside of it (in a similar fashion to UNIX /dev
folder) and have a specific one for every platform... What do you
think?
2012/2/21 Luciodj <lucio....@googlemail.com>:
> --
> You are subscribed to the "python-on-a-chip" (or p14p for short) Google Group.
> Site: http://groups.google.com/group/python-on-a-chip
--
"Si quieres viajar alrededor del mundo y ser invitado a hablar en un
monton de sitios diferentes, simplemente escribe un sistema operativo
Unix."
– Linus Tordvals, creador del sistema operativo Linux
eLua gives common access to peripherals across micros. But making and maintaining that code is a significant undertaking.
OpenPilot has a peripheral abstraction layer, I describe more here: http://groups.google.com/group/python-on-a-chip/browse_thread/thread/aa221409424e5efd/b7c4da0117f37757?lnk=gst&q=%22openpilot%22#b7c4da0117f37757
I like the idea of a very thin layer because it increases the likelihood of success and maintenance. However, I do intend to give p14p coders a high-level api; not everybody is a professional embedded developer. So the trick will be to find a nice balance between high-level interface and small code size.
!!Dean