esp01s如何烧录、接线///arduino串口想输出字符串,但是输出了数字
esp01s与usb转ttl接线:
| esp01s | 连线 | usb转ttl | 
|---|---|---|
| 3V3 | --------- | 3V3 | 
| GND | --------- | GND | 
| RX | --------- | TXD | 
| TX | --------- | RXD | 
| IO0 | --------- | GND | 
IO0接地作用是:进入烧录模式,
 IO0接地之后需要断电,重新上电。
 完成烧录后需要 断开 IO0与GND否则程序无法运行。
arduino串口想输出字符串,但是输出了数字
  int RXString;
  if(Serial.available()>0)
  {
    RXString = Serial.read();
    
    Serial.write(RXString);
  }
 
这是一个串口透传代码:即接收到来自串口数据就立即发送出去。
 遇到的问题是,串口输入字符串,输出的是数字。
 比如输入A,输出65
实际上,65是ASCII码的“A”,所以arduino的串口输出并无错误。
 那么如何输出“A”呢,只需要将输出RXString转换成char即可
  int RXString;
  if(Serial.available()>0)
  {
    RXString = Serial.read();
    
    Serial.write(char(RXString));
  }