当前位置:网站首页>Some experiences of Arduino soft serial port communication
Some experiences of Arduino soft serial port communication
2022-07-03 07:19:00 【yuchu3d】
1、arduino On the main board RX TX Pin Sometimes not enough , At this time, we need to put others Pin Through software Analog to serial communication pin , But not every pin Can be converted like this , Different boards , Somewhat different .
2、arduino Uno There is only one RX TX Pin , Namely 0 and 1 Pin , These two pins are usually used to communicate with the computer by default ,Serial.begin Serial.print Serial.read This pin is targeted . If arduino Uno Serial communication with other hardware is required , It must be Set soft serial port , Put other pins Used as a serial communication pin . First Will be Contains the corresponding library functions SoftwareSerial.h , then use SoftwareSerial name(rxPin, txPin) To define a soft serial port name, also And use it name.listen(), To monitor this soft serial port . Of course Nor can any pin be used as a serial communication pin ( The pin needs to support interrupt function ).
3、 If the original arduino On my board There is More than one TX RX Pin , Sometimes You can use it directly On the board TX RX Pin . With arduino mega 2560 Come on , Above all Yes RX0 TX0, RX1 TX1,RX2 TX2,RX3 TX3 Four pairs of serial port pins , RX0 TX0 , It communicates with the computer by default , use serial Set up , When communicating with other boards , If it is connected to RX1 TX1 On , We use it serial1 To set up , Empathy Connect to RX2 TX2 On , We use it serial2 To set up , You don't need to use SoftwareSerial To set the soft serial port , Also need not listen() Function to monitor . however If we use other pins such as 10 11 To do serial communication , To use SoftwareSerial name(rxPin, txPin) To set .
边栏推荐
猜你喜欢
随机推荐
4EVERLAND:IPFS 上的 Web3 开发者中心,部署了超过 30,000 个 Dapp!
Deep learning parameter initialization (I) Xavier initialization with code
Laravel frame step pit (I)
mysql误删root账户导致无法登录
TypeScript let与var的区别
多个全局异常处理类,怎么规定执行顺序
Advanced API (character stream & net for beginners)
Distributed transactions
《指环王:力量之戒》新剧照 力量之戒铸造者亮相
In depth analysis of reentrantlock fair lock and unfair lock source code implementation
php安装swoole扩展
VMware virtual machine installation
File operation serialization recursive copy
PAT甲级真题1166
Pat grade a real problem 1166
2021-07-18
How can I split a string at the first occurrence of “-” (minus sign) into two $vars with PHP?
【已解决】win10找不到本地组策略编辑器解决方法
10 000 volumes - Guide de l'investisseur en valeur [l'éducation d'un investisseur en valeur]
"Baidu Cup" CTF game 2017 February, Web: blast-1