Raspberry Pi using Scratch as HMI, involving wiringPi and Qt for programming and open source hardware boards from electronics.cat.
Boards used in the video :
Raspberry Pi : Raspberry Pi
set05_08 : 3Bpi - Level translator board for Raspberry Pi
set05_04 : Input Board
set05_02 : Relays Board
set01_04 : Inputs and Outputs (microswitch + LEDs)
Requirements :
- Qt4 tool chain installed on Raspberry Pi
- wiringPi installed on Raspberry Pi
- Connect reliable hardware to GPIO (be aware Raspberry Pi use 3.3V internally)
To compile Qt code using wiringPi on Raspberry Pi :
- Uncompress Qt code using wiringPi
- On the qtPi04 directory, type on the terminal :
qmake
make
To run this sample :
- Run Scratch and open Scratch’s code
- Type on terminal :
sudo ./qtPi04
pi@raspberrypi ~/code/wiringPi/qtPi04 $ sudo ./qtPi04
3Bpi + Raspberry Pi + Qt + wiringPi test program
TCP disconnected
Scratch cannot be connected through TCP <= If Scratch is not running
“xxxx1111″
pi@raspberrypi ~/code/wiringPi/qtPi04 $ sudo ./qtPi04
3Bpi + Raspberry Pi + Qt + wiringPi test program
TCP connected
Scratch connected through TCP <= If Scratch is running with Scratch’s code opened
“xxxx1111″
“xxxx1101″ <= When a switch is pressed
“sensor-update note 60 beats 0.4″
“broadcast “0×3E_SW1_pressed”"
“xxxx1111″
“sensor-update note 62 beats 0.4″
“broadcast “0×3E_SW1_unpressed”"
As a tip to understand how it is programmed this is a C code using wiringPi and this is its translation to C++ using Qt and wiringPi.