Page 1 of 1

Raspberry Pi system command.

Posted: Sat Oct 06, 2018 9:00 am
by mnf
One for Raspberry Pi users:

Was thinking about unzipping a file on the Pi - using Flowcode.. That would be a big project and madness unless you had )a lots of time and b) someone was paying big bucks and c) lots of (hard) work.

So the easy way is to use someone else's code. The good news is that this is straightforward.

Use the 'system' command in a C macro.

So for example:

Code: Select all

system("mkdir test");      // Create a new directory 'test'


Code: Select all

system("gunzip file.gz");   // Unzip file.gz

This only works for Pi users (at present) - where the underlying OS has commands available. To make things more general - build and use a string variable and then: (take a peek at the C code to get the variable names FC has used)

Code: Select all

system(FCV_S);   // Use global string S as a command....


Re: Raspberry Pi system command.

Posted: Fri Nov 01, 2019 12:40 am
by mnf
Happy Halloween to you all..

A Flowcode Haunted House Project....

This was supposed to have been a weekend project - but building the house itself took a lot of time. It is from Matt Bergstrom's 'Cut and Assemble' haunted house book - and the result is a nicely detailed model. There is plenty of room inside for 'wiring' and gubbins. However it is 'paper' and some reinforcement might have been a good idea. I rather ran out of time and only installed 5 LEDs for room lights. I might add more later to the lower rooms - but the upper stories would be harder.

I initially intended to use an Arduino with a sound shield - but because I wanted to play multiple sounds at once and also trigger the lights whilst sounds are playing - I opted for a Raspberry Pi3. The display is self contained and uses a battery pack and cordless speaker for the sound. I'd intended to use a coin slot for starting the display - but ended up using an illuminated button (FC has one - but doesn't seem to have a way to turn the LED on and off - so used separate components..) due to lack of time.

Flowcode - made the actual coding very easy (I didn't have much time to meet the Halloween deadline.) I downloaded some sound effects from SoundBible - and found a 'creepy' tune on my laptop (from a game - just not sure which) I used WinSCP to transfer files to the Pi - FC also worked beautifully with Pi working 'headlessly'. I added a line to /etc/rc.local to run the program on boot too.

I did this to try and raise some money for a local appeal - but if I'd had some more time I'd have randomised the effects and added some extra sounds, lights and possibly movement with a servo or a solenoid....

Original plan was also to install inside fishtank (inverted) for protection mainly - but with LED strip lights in the corners providing additional illuminations. I used an ULN2803 chip to control the 12v lights via the Pi...

Oh - and I used the system command to play the sounds....

Video at - now uploaded....

(27.97 KiB) Downloaded 53 times