Group Abstract Group Abstract

Message Boards Message Boards

Writing to GPIO from remote notebook

GROUPS:
I've noticed that the 
DeviceConfigure["GPIO", 4 -> "Output"]
DeviceWrite["GPIO",4 -> 1]
does nothing being executed from the remote kernel of Mathematica.
When I write just
DeviceWrite["GPIO",4 -> 1]
from the command line, it works and the LED on GPIO4 pin turns on.

It's also interesting that the
DeviceConfigure["GPIO", 4 -> "Input"]
DeviceRead["GPIO",4]
works fine from the remote kernel and reads the real logical state of the pin.
You can even set "1" at GPIO4 from the console and read this "1" from the remote kernel (the fact that the pin has been configured as input from the remote kernel ignores at the console).
--- UPD ---
I've just executed 
DeviceConfigure["GPIO", 4 -> "Input"]
from the console and it worked for the remote kernel (I can't write at GPIO4 anymore). Then I did
DeviceConfigure["GPIO", 4 -> "Output"]
DeviceWrite["GPIO",4 -> 1]
again from the remote notebook and the LED turned on!!! 
I really don't understand how everything started to work, but it works now.
Maybe DeviceConfigure[] works unstable being executed from the remote.
POSTED BY: Himura Kazuto
Answer
5 months ago
Was the remote kernel being run as root or with "sudo"?
POSTED BY: Alex Newman
Answer
5 months ago
No. Can I do it by editing the corresponding option in EvaluatorNames using Option Inspector? 
I guess I should treat Kernel Program string by sudo header. Raspberrian doesn't ask password for sudo from "pi" account as I remember
--- upd ---
It can be done by putting root as a user in Kernel Configuration Options
POSTED BY: Himura Kazuto
Answer
4 months ago