Strange behaviour of system() call

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Strange behaviour of system() call

Post by pz1 »

I intend to use Gordon Hendersons wiringPi software (http://wiringPi.com) to drive my Somfy sunshades from OpenRemote (see my post http://www.openremote.org/display/forum ... t-22875010)

I use the wiringPi module (gpio command) in the following script:

#!/bin/sh
PIN=$1
gpio mode $PIN out
gpio write $PIN 1
sleep 0.1
gpio write $PIN 0

I have the script stored as: /opt/z-way-server/automation/GPIO.sh
This works fine if called from the Raspberry Pi command line.

However if I call it from within Javascript with a system() call as:

(http://raspberry:8083/JS/Run/system("/o ... on/GPIO.sh " %2B 12))

I do get error 32512. This error does not appear if I put a # sign before the last line.

I have worked this through with PoltoS, where we concluded that the system() call itself works OK

Something funny seems to be happening in that last line of the GPIO script

Anybody out here who has a clue of what may be wrong?
Thanks,
Pieter
Since 29-12-2016 I am no longer a moderator for this forum
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

I solved the problem, I

Post by pz1 »

I solved the problem, I should have placed the path (/usr/local/bin/) to the gpio command in the batchfile
Since 29-12-2016 I am no longer a moderator for this forum
puesb
Posts: 8
Joined: 11 Mar 2013 00:21

Re: Strange behaviour of system() call

Post by puesb »

Hello,

Stupid question what do I have to install to run JavaScripts remotely? (http://raspberry:8083/JS/Run/system)

Thank you very much

Bart
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Strange behaviour of system() call

Post by pz1 »

What do you expect system will do for you? In other words what do you try to achieve?
Since 29-12-2016 I am no longer a moderator for this forum
puesb
Posts: 8
Joined: 11 Mar 2013 00:21

Re: Strange behaviour of system() call

Post by puesb »

execute a gpio command remotely. preferably in the same way as the zwaveApi (example: http//razberryIP:8083/ZWaveAPI/Run/devices[4].instances[0].commandClasses[0x43].data[1])
I concluded from your example in the initial post, that this would be easy.
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Strange behaviour of system() call

Post by pz1 »

puesb wrote:execute a gpio command remotely. preferably in the same way as the zwaveApi (example: http//razberryIP:8083/ZWaveAPI/Run/devices[4].instances[0].commandClasses[0x43].data[1])
I concluded from your example in the initial post, that this would be easy.
Sorry, I missed this post.
Did you follow all the instructions from the Sunshades example?
If you want to follow my example you do have to install wiringPi as decribed there, and amongst others make sure that you have the shell script command in .syscommands
Since 29-12-2016 I am no longer a moderator for this forum
Post Reply