I have a Raspberry Pi connected via a USB serial connection to an Arduino Uno, which is connected to an AM2302 humidity/temperature sensor. I am able to read the data from the sensor into Mathematica and then send the data by email and to a web server. No problems if I run the code within a Notebook.
My next step is to put the code into my init.m file (which is in /usr/share/WolframEngine/Kernel) so that it runs when I start Mathematica. This is where I run into a problem. The code starts to evaluate fine, with an email message letting me know, but then I get these messages:
Import::format: Cannot import data as HeldExpressions.
DeviceOpen::noclass:
A driver for Serial was not found on your local computer or currently
available paclet sites. If you can locate the driver, add the driver
directory to $Path or load the driver directly with Get. If you cannot
locate the driver, contact the device manufacturer or create a driver
using the Wolfram Device Framework. See http://devices.wolfram.com for
more information.
The code that worked in the Notebook is the only thing that is in init.m, so it isn't a matter of a conflict with other code.
The serial connection I successfully make within the Notebook version is
port = "/dev/ttyACM0"
dev = DeviceOpen["Serial", {port, "BaudRate" -> 9600}];
Any idea what's going on
Ken Levasseur UMass Lowell