Hi,
Is there easy way to write block/libraries in C which to link to Scratch without messing with whole source rebuild?
I'm asking as Scratch is running fine on OLinuXino http://olimex.wordpress.com/2013/03/12/a13-olinuxino-wifi-running-scratch-ide-perfect-platform-for-kids-programming-education/ and the board have GPIOs, SPI, I2C, etc resources which could be easily made available to the Scratch programmers if there was some kind of library/modules like in Python for instance.
Here is Python GPIO module for OLinuXino http://olimex.wordpress.com/2013/03/08/a13-olinuxino-gpio-python-libraries/ which can be used as easily as:
import A13_GPIO as GPIO
then you can use GPIOs in your python code like:
GPIO.init() #init GPIOs
GPIO.getcfg(GPIO.PIN37) #config PIN37 as GPIO
GPIO.setcfg(GPIO.PIN37, GPIO.OUTPUT) #config PIN37 as output
GPIO.output(GPIO.PIN37, GPIO.HIGH) #set PIN37 high
GPIO.output(GPIO.PIN37, GPIO.LOW) #set PIN37 low
GPIO.setcfg(GPIO.PIN37, GPIO.INPUT) #config PIN37 as input
GPIO.input(GPIO.PIN37) #read PIN37
easy way to define blocks outside scratch then import them will unleash a lot of apps with physical world interfacing like robots etc.
OpenCV for instance is running fine on OLinuXino and there may be "face recognition" blocks if there is easy way to write C extension blocks.
Best regards
Tsvetan Usunov
Olimex
Offline