树莓派查询串口
ls /dev/tty*
通过 拔插发现多了一个
就是他了。
arudnio代码
void setup()
{
Serial.begin(9600); //打开串口
}
void loop()
{
Serial.println("Hello Raspberry,I am Arduino.");
delay(1000);
if ( Serial.available())
{
if('s' == Serial.read())
Serial.println("Hello Raspberry,I am Arduino.");
}
}
单串口
# -*- coding: utf-8 -*
import serial
import time
ser = serial.Serial('/dev/ttyUSB0', 115200)
if ser.isOpen == False:
ser.open() # 打开串口
ser.write(b"Raspberry pi is ready")
try:
while True:
response =