从树莓到Arduino的串行通信与phpSerial不工作
Serial communication from Raspberry to Arduino with phpSerial not working
我开发了一个软件,我需要使用树莓的串口向arduino发送数据。
我使用phpSerial,但不可能知道用这个代码在Arduino上接收到什么数据。我用端口2上的led进行测试,但当我发送此数据时,led不亮。
对树莓 $serial = new phpSerial;
$serial->deviceSet("/dev/ttyACM0");
$serial->confBaudRate(115200);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->deviceOpen();
sleep(1);
$serial->sendMessage("1");
echo $serial->readPort();
$serial->deviceClose();
ON ARDUINO
if (Serial.available() > 0) {
readed_char[i] = (char)Serial.read();
Serial.print(readed_char[i]);
if (readed_char[0] == '1'){
digitalWrite(2,HIGH);
}
}
谢谢你的帮助
不需要配置硬件握手吗?
你读到readed_char[i],但检查readed_char[0],这是正确的吗?
BTW:英语中没有"已读"
相关文章:
- VSOMEIP-2个设备之间的通信(TCP/UDP)不工作
- 是否可以使用winusb同时与多个相同的usb设备进行通信
- 混淆了如何使用IDL与Ethovision进行通信
- C++ Boost::asio串行通信与Arduino无法写入
- 我是否需要包含隐式使用/与 WindowsAPI 通信"Windows.h"?
- 通过TCP的PvP通信问题
- C++一个线程如何正确通信其任务已完成?
- 如何将 Firebase 与基于 Linux 的客户端应用配合使用,以便与服务器进行双向消息通信
- 删除功能不适用于串行通信后多个循环中的多个实例
- 网站和C++程序在同一台 Linux PC 上的通信
- 通过插槽和信号在不同线程中的两个qt对象之间进行通信
- 使用 pybind11 共享 MPI 通信器
- 进程间通信堆内存
- C++ TCP 套接字通信 - 连接按预期工作,几秒钟后失败,没有收到新数据,read() 和 recv() 块
- C++ 两台不同机器之间通过wifi进行套接字通信
- 提升::Asio 异步聊天客户端停止与服务器通信
- 与SPI NAND闪存(STM32L4,QSPI)的通信问题
- 线程之间的通信不起作用 - C++
- 如何在此功能中没有通信过程?
- 从树莓到Arduino的串行通信与phpSerial不工作