I'm making an IoT project: A fingerprint lock with the major function is open with the identification of finger-ID and minor function is upload the time when we entrance to the internet. We can see these data via HTML pages or directly type address in web browsers.
But the major problem is: The major function I code in Arduino IDE (I cannot code in other language cause it contains libraries that supported only in Arduino IDE- adafruit fingerprint library). And the rest- upload data to the internet and show them in web browsers is written in node.js(which is available in Intel XDK). So how can I make these two code run parallel in Intel Galileo 2 and they can commute each other.
First, I tried upload a node.js to Galileo via Intel XDK and then upload program.ino via Arduino IDE and encountered an error with putty... something like Arduino IDE want to erase the old sketch and upload the new one but it has no right to do so. It show "permission denied".
So, can anyone show me the method for 2 "languages": Arduino and Linux run parallel and Linux can refer to data drawn from Arduino pinout embeded in Galileo and post them in the internet so we can see them via html or something like that.
Thanks a lot! ^_^
I recommend you to try to execute the node script directly in the Galileo's terminal. Every script, including Arduino sketches, is a process in the Linux OS. You can execute a node script and an Arduino sketch at the same time. From the Linux side, it would be seen as two processes running. Maybe the way how the XDK uploads and runs the script is causing that behavior.
If you have your script (.js), you can copy it and execute it directly in Galileo's terminal by running the following command: node myScript.js. This approach might work and let you execute the node script and upload an Arduino sketch to have both running.
On the other hand, I recommend you to check the following document where there is an explanation about how to share data between an Arduino sketch and a script running in the Linux side. Actually, the document uses an example between an Arduino sketch and a NodeJS script. You might find it interesting: https://software.intel.com/en-us/blogs/2015/05/05/efficient-data-sharing-using-interrupts-on-intel-e... IoT - Data sharing between programming environments on Intel® Edison | Intel® Developer Zone
Another option would be to write what the NodeJS script does in the Arduino sketch. That way you would have all the code in one place. If the NodeJS script is used to upload data to the Internet, then one of the WiFi examples in the Arduino IDE might help you to write an Arduino sketch that does the same thing.
Thank you for your recommendation. After trying many ways, I realized that (for me) the easiest way to communicate between Arduino IDE and Linux environment is using temporary files. Something like txt file that both Arduino IDE and Linux can read and write over them.
I wish one day there were a language which could replace all present languages. All in one ^_^