Serial port 通过RF 433MHz在两个Arduinos系统之间传输的数据';在没有ttyUSB串行连接的情况下,TFT LCD1.8上不会显示

Serial port 通过RF 433MHz在两个Arduinos系统之间传输的数据';在没有ttyUSB串行连接的情况下,TFT LCD1.8上不会显示,serial-port,arduino-uno,tty,Serial Port,Arduino Uno,Tty,发射机工作正常。但是如果没有ttyUSB串行连接,接收器就不能工作。我的意思是,每当我断开电脑与接收器的连接时,它都不会显示它从发射器获取的数据。我希望它能在没有PC的情况下工作,只需要外部电源。可能出了什么问题 /* 单纯的 此草图显示使用VirtualWire接收的文本字符串 将接收器数据引脚连接至Arduino引脚3(默认为11) */ #包括 #包括//Arduino LCD库 #包括 //Uno的pin定义 #定义cs 10 #定义dc 9 #定义rst 8 //创建库的实例 TFT

发射机工作正常。但是如果没有ttyUSB串行连接,接收器就不能工作。我的意思是,每当我断开电脑与接收器的连接时,它都不会显示它从发射器获取的数据。我希望它能在没有PC的情况下工作,只需要外部电源。可能出了什么问题

/*
单纯的
此草图显示使用VirtualWire接收的文本字符串
将接收器数据引脚连接至Arduino引脚3(默认为11)
*/
#包括
#包括//Arduino LCD库
#包括
//Uno的pin定义
#定义cs 10
#定义dc 9
#定义rst 8
//创建库的实例
TFT屏幕=TFT(cs、dc、rst);
//要打印到屏幕上的字符数组
//煤焦温度[4];
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8\u t buflen=大众最大消息长度;
常数int蜂鸣器=2//蜂鸣器至arduino针脚2
无效设置()
{
//将此线放在使用GLCD的每个草图的开头:
TFTscreen.begin();
//清除带有黑色背景的屏幕
TFT屏幕背景(0,0,0);
//将静态文本写入屏幕
//将字体颜色设置为白色
TFTscreen.stroke(255、255、255);
//设置字体大小
TFTscreen.setTextSize(1);
//将文本写入屏幕的左上角
文本(“温度:\n”,5,5);
//ste循环的字体大小非常大
TFTscreen.setTextSize(2);
引脚模式(蜂鸣器,输出);//将蜂鸣器-引脚2设置为输出
//初始化IO和ISR
//vw_set_ptt_inversed(true);//DR3100需要
vw_设置(2000);//位/秒
vw_rx_start();//启动接收器
}
void循环()
{
if(vw_get_message(buf,&buflen))//非阻塞
{
//设置字体颜色
TFTscreen.stroke(255、255、255);
//打印传感器值
文本((char*)buf,20,20);
//等一下
延迟(1000);
//删除你刚才写的文字
TFT屏幕行程(0,0,0);
文本((char*)buf,20,20);
音调(蜂鸣器,2000);//发送1KHz声音信号。。。
延迟(1000);
诺通(蜂鸣器);
}
否则{
//设置字体颜色
屏幕行程(255,255,0);
TFTscreen.setTextSize(1);
//打印传感器值
文本(“未连接”,20,20);
//等一下
延迟(500);
//删除你刚才写的文字
TFT屏幕行程(0,0,0);
TFTscreen.setTextSize(1);
文本(“未连接”,20,20);
}
}

已解决。USB电缆实际上起着天线(收音机)的作用。当我断开它时,它会失去连接

/*
 SimpleReceive
 This sketch displays text strings received using VirtualWire
 Connect the Receiver data pin to Arduino pin 3 (default 11)
*/
#include <VirtualWire.h>
#include <TFT.h>  // Arduino LCD library
#include <SPI.h>

// pin definition for the Uno
#define cs   10
#define dc   9
#define rst  8

// create an instance of the library
TFT TFTscreen = TFT(cs, dc, rst);

// char array to print to the screen

//char temperatureChar[4];
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen=VW_MAX_MESSAGE_LEN;



const int buzzer = 2; //buzzer to arduino pin 2




void setup()
{

 // Put this line at the beginning of every sketch that uses the GLCD:
  TFTscreen.begin();

  // clear the screen with a black background
  TFTscreen.background(0, 0, 0);

  // write the static text to the screen
  // set the font color to white
  TFTscreen.stroke(255, 255, 255);
  // set the font size
  TFTscreen.setTextSize(1);
  // write the text to the top left corner of the screen
  TFTscreen.text("Temp :\n ", 5, 5);
  // ste the font size very large for the loop
  TFTscreen.setTextSize(2);


 pinMode(buzzer, OUTPUT); // Set buzzer - pin 2 as an output
 // Initialize the IO and ISR
 //vw_set_ptt_inverted(true); // Required for DR3100
 vw_setup(2000); // Bits per sec
 vw_rx_start(); // Start the receiver
}
void loop()
{


  if(vw_get_message(buf, &buflen)) //non-blocking
  {
    // set the font color
  TFTscreen.stroke(255, 255, 255);
  // print the sensor value
  TFTscreen.text((char *)buf, 20, 20);
  // wait for a moment
  delay(1000);
  // erase the text you just wrote
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.text((char *)buf, 20, 20);


 tone(buzzer, 2000); // Send 1KHz sound signal...
 delay(1000);

 noTone(buzzer);
 }
 else {
  // set the font color
  TFTscreen.stroke(255, 255, 0);

  TFTscreen.setTextSize(1);
  // print the sensor value
  TFTscreen.text("Not connected", 20, 20);
  // wait for a moment
  delay(500);
  // erase the text you just wrote
  TFTscreen.stroke(0, 0, 0);
  TFTscreen.setTextSize(1);
  TFTscreen.text("Not connected", 20, 20);

       }
 }