derez Expert Licensed User Longtime User Dec 17, 2015 #1 How should I tell the RB to reboot from inside a sever appliction running in it ? Or run another application (I can put the command in a script file).
How should I tell the RB to reboot from inside a sever appliction running in it ? Or run another application (I can put the command in a script file).
I inakigarm Well-Known Member Licensed User Longtime User Dec 17, 2015 #2 You can use jshell to execute a command or script to reset the RB Code: Copy sudo shutdown –h or sudo shutdown –r now (halt or restart) P.D: I can't test it for now... Upvote 0
You can use jshell to execute a command or script to reset the RB Code: Copy sudo shutdown –h or sudo shutdown –r now (halt or restart) P.D: I can't test it for now...
derez Expert Licensed User Longtime User Dec 18, 2015 #3 Thanks ! This works: Code: Copy Dim shl As Shell shl.Initialize("shl", "reboot", Array As String()) shl.Run(-1) Upvote 0
Thanks ! This works: Code: Copy Dim shl As Shell shl.Initialize("shl", "reboot", Array As String()) shl.Run(-1)
derez Expert Licensed User Longtime User Dec 18, 2015 #4 Now I have another problem... The GPIO library doesn't work with OrangePi but I have found these commands that when run from the terminal - turn the pin on and off: http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=148 Code: Copy echo 1 > /sys/class/gpio_sw/PA1/data echo 0 > /sys/class/gpio_sw/PA1/data When I perform it from an application, like this: Code: Copy shl.Initialize("shl", "echo 1 > /sys/class/gpio_sw/" & pin_name & "/data", Null) It doesn't work. How should I use shell in this case ? Upvote 0
Now I have another problem... The GPIO library doesn't work with OrangePi but I have found these commands that when run from the terminal - turn the pin on and off: http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=148 Code: Copy echo 1 > /sys/class/gpio_sw/PA1/data echo 0 > /sys/class/gpio_sw/PA1/data When I perform it from an application, like this: Code: Copy shl.Initialize("shl", "echo 1 > /sys/class/gpio_sw/" & pin_name & "/data", Null) It doesn't work. How should I use shell in this case ?
R Roycefer Well-Known Member Licensed User Longtime User Dec 18, 2015 #5 Looking at those commands, all you're doing is writing the numbers 1 and 0 to the file /sys/class/gpio_sw/PA1/data. You might as well try doing that with a TextWriter or a File.WriteString() call. The single greater-than sign means you're NOT appending to the file so make sure the TextWriter doesn't, either. Upvote 0
Looking at those commands, all you're doing is writing the numbers 1 and 0 to the file /sys/class/gpio_sw/PA1/data. You might as well try doing that with a TextWriter or a File.WriteString() call. The single greater-than sign means you're NOT appending to the file so make sure the TextWriter doesn't, either.
derez Expert Licensed User Longtime User Dec 18, 2015 #6 Thanks ! It works with File.writestring: Code: Copy public Sub WritePin(pin_name As String, pin_on As Boolean) If pin_on Then File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","data","1") Else File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","data","0") End If End Sub To define the function of the pin (input or output) I use Code: Copy Public Sub DefinePin(pin_name As String, Write As Boolean) If Write Then File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","cfg","1") Else File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","cfg","0") End If End Sub (not tested yet...) How should I work with this command, for reading the data from a pin ? Code: Copy cat /sys/class/gpio_sw/PA1/data Edit: I have found that cat provides data, I'll test and find the type of it, but anyway there are more required definitions (pwm, digital or analog read etc), we do need a librry here, Can someone find the code of wiringpi library ? it might help to find the definitions. Last edited: Dec 18, 2015 Upvote 0
Thanks ! It works with File.writestring: Code: Copy public Sub WritePin(pin_name As String, pin_on As Boolean) If pin_on Then File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","data","1") Else File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","data","0") End If End Sub To define the function of the pin (input or output) I use Code: Copy Public Sub DefinePin(pin_name As String, Write As Boolean) If Write Then File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","cfg","1") Else File.WriteString("/sys/class/gpio_sw/" & pin_name & "/","cfg","0") End If End Sub (not tested yet...) How should I work with this command, for reading the data from a pin ? Code: Copy cat /sys/class/gpio_sw/PA1/data Edit: I have found that cat provides data, I'll test and find the type of it, but anyway there are more required definitions (pwm, digital or analog read etc), we do need a librry here, Can someone find the code of wiringpi library ? it might help to find the definitions.