Hey, guys! I'm finally getting around to using my Udoo Neo I got way back from the Kickstarter for my R2-D2 project. I'm going to try and use the Udoo to drive the sound and control the servos to make things open/close on R2. Here's how I got the AP setup: https://www.udoo.org/docs-neo/Wireless_Communication/WiFi_SoftAP.html Here's how I'm running the web server: https://www.udoo.org/tutorial/udoo-web-server/ I've got everything working but can't figure out how to send commands to the GPIO / Arduino. In order to play audio on the Udoo (and not my phone) I'm using the PHP command "exec" to play an MP3. Ideally, I would like to do something similar to control the GPIO or to call an Arduino function. I found this guide but it uses Python and I'd like to avoid that if at all possible. https://www.udoo.org/forum/threads/how-to-control-neo-arduino-from-web-page.6242/
Check the community libraries https://www.udoo.org/docs-neo/UDOO_NEO_made_by_the_Community/Java.html For PHP Arduino communication see https://www.udoo.org/docs-neo/Serial_Libraries/PHP_Serial_Libraries.html
Alright, I think I finally found the right files (the help site you sent me to says to upload an Arduino sketch but there's no mention of what sketch or how to find it). I found this: https://github.com/UDOOboard/serial_libraries_examples Uploaded this sketch: https://github.com/UDOOboard/serial...ino_serial_example/arduino_serial_example.ino Then I cloned the GitHub repo onto my Udoo Neo and did this: sudo ln -s /dev/ttyMCC /dev/ttyS0 udooer@R2-D2:~$ cd serial_libraries_examples/ udooer@R2-D2:~/serial_libraries_examples$ cd php udooer@R2-D2:~/serial_libraries_examples/php$ php -S 0.0.0.0:8081 I was only able to get the example to work by running that php command with sudo. I'm running another web server on port 8080. Is there a way to add this php example to that existing port without running it as sudo?
Sorry I had to link you to 1 level higher page of the documentation: https://www.udoo.org/docs-neo/Serial_Libraries/index.html Regarding sudo en webserver, you are the PHP expert of us both But I suspect you have to merge the code of the communication example into your existing PHP site. Using sudo is normally because something has to be done where a user has no rights to. You could make a user group with the right permissions and add the user to that group.
I finally figured it out. For some reason I had to change define("PORT","/dev/ttyS0"); in the serial_libraries_examples/php/index.php file to define("PORT","/dev/ttyMCC"); and it worked! Thanks again for all your help. This project is moving along nicely.