Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: gavinmc42 on November 06, 2015, 12:05:18 AM
-
Hi all,
Just been playing with making a tcz of this.
http://abyz.co.uk/rpi/pigpio/index.html
Having trouble with the import pigpio in micropython.
The pigpio.py file has lots of stuff micropython does not like.
But I did get the pigs command line stuff to work.
Been using micropython to drive a single stepper motor.
I can see and hear the jitter from the linux kernel effects on the software loop.
Hopefully moving to shell script calling pigs this will fix this.
Need to learn more about import in python.
GPIO18 has a PWM function, so I could do a hardware version?
-
Interesting, pipgio has scripting.
To make a script.
pigs proc tag 999 w 27 1 mils 1 w 27 0 mils 1 dcr p0 jp 999
this will return a number x
Run script 1000 times
pigs procr x 1000
Have not tested how fast it will toggle a GPIO yet but this gives me a 500Hz pulse train for my stepper driver.
By changing the first mils 1 to mics 10 ( stepper driver minimum pulse width is 2.5us) I doubled the speed.
1000Hz is fine on the stepper I have, 2000Hz is too fast.
Sounds much quieter and smoother than the python software loop method.
-
Having trouble with the import pigpio in micropython.
The pigpio.py file has lots of stuff micropython does not like.
But I did get the pigs command line stuff to work.
MicroPython is targeting full language compatibility to cPython at the core, but not on the module level. To be precise commonly used modules are offering subset of cPython modules with subset of functions, but these are intended to work on the same way if possible. Keep in mind that MicroPython is for microcontrollers with limited resources primarily.
There is an ongoing discussion at GitHub on the hw independent hardware layer module which will offer use of peripherial devices like I/O, serial line, i2c, spi, pwm, etc. Later this can be implemented for RPi too.
Now you can use os.system to call a command line tool from MicroPython.
Also you can make your own MicroPython module using libffi to interface external C libraries. Study source code of MicroPython.
MicroPython forum is another source of information, community is great and core developers are active there. Use it for MicroPython related stuff.
-
Yep been reading up on micropython, might not wait for the BBC microbit, may have to make my own.
Need a pyb import for the Pi.
https://micropython.org/doc/module/pyb/
Probably someone already working on it?
In the meantime pigpio scripting is working good enough for what I needed to do this week.