Page 1 of 1

Strange behaviour of system() call

Posted: 18 Aug 2013 16:56
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

I solved the problem, I

Posted: 18 Aug 2013 16:56
by pz1
I solved the problem, I should have placed the path (/usr/local/bin/) to the gpio command in the batchfile

Re: Strange behaviour of system() call

Posted: 22 Aug 2014 15:41
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

Re: Strange behaviour of system() call

Posted: 22 Aug 2014 16:37
by pz1
What do you expect system will do for you? In other words what do you try to achieve?

Re: Strange behaviour of system() call

Posted: 22 Aug 2014 16:58
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.

Re: Strange behaviour of system() call

Posted: 26 Aug 2014 13:46
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