ArduinoLinuxSerial
1.0.0
这是用于Linux上PHP-Arduino通信的助手课程
经过一周的谷歌搜索和测试后,我构建了此类课程,可以通过串行USB在Linux(Master)上运行的PHP通信到Arduino董事会。
主消息最大长度为60个字符(串行Arduino RX缓冲区限制),响应(来自Arduino)是没有限制的。 “ n” char在内部用作终结者。该协议使用CRC8确保正确性。如果出错,则在以错误状态退出之前将消息延迟3次。
Bash脚本(SerialArduino.SH)用于在Linux上,启动或USB(RE)连接后设置USB设备。每条消息都打开了串行通信:在BASH脚本中,DTR PIN被禁用,以避免Arduino自动重置。 (请参阅:https://playground.arduino.cc/main/disablingautoresetonserialconnection)
故障排除
设置
请参阅arduinolinuxserial.php文件。
结论
Now you can develop MySQL and web enabled Arduino applications only working on Arduino and PHP.
To keep ligth the Arduino Sketch, you can port all not realtime logic to PHP side.
At the end your application will works on MXQ+Arduino UNO even 24/7 with only 20 Watt AC power, and can
be controlled by smartphone via WiFi.
What more?
Enjoy.
我对使用TVBoxes(例如MXQ)作为具有Arduino扩展名的专用Web服务器非常感兴趣:So Airo(Linux + Android)-Arduino USB序列通信我测试了许多解决方案:
Using ArduinoLinuxSerial (https://github.com/msillano/ArduinoLinuxSerial) the Master is php, and you need the
serial driver (uses devices like /dev/ACMx or /dev/USBx). It is blocking the master and the php->Arduino message
is limited to 60 char. Fast and robust (CRC and repetions). Useful with simple and fast Arduino responses.
Using USBphpTunnel (https://github.com/msillano/USBphpTunnel) the master is Arduino, and the Android app uses
ports like /dev/bus/dev/00X/00Y, so you don't need the serial driver. It is blocking the master (arduino) and
it allows big messages. It works in background of the main php program. Useful for data logging and RT.
Using USBphpTunnel_Fifo (https://github.com/msillano/USBphpTunnel_fifo) the master is php. It is NOT blocking the
master, allows payload up to 4k, allows concurrence (many users via WIFI). Works in background, and it is no fast
(depending from polling Arduno frequence, 5-15 sec. plus processing time). Well placed for long Arduino processes
(like waiting user actions).