My goal is to write a string through the serial of my Raspberry Pi which will then be sent towards an Arduino and I'll read it through the Serial Monitor.
I got my Python script working and it works perfectly when I execute it on the Raspberry Pi's terminal. As soon as I run it through the website, it does not work.
To test it out, I made the PHP code run the script as soon as the site was launched. This is what the code looks like:
<?php exec('/usr/bin/python /var/www/UART3.py test'); ?>
The test at the end of the exec() sends that string through the serial communication. I can copy and paste that code into the terminal and it works perfectly.
Things I have done:
- Tested the code individually (works)
- Gave rights to www-data by doing
chmod +x UART3.py