日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

arduinoUno连接发射模块与接收模块跟显示屏说明

發布時間:2024/3/24 编程问答 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 arduinoUno连接发射模块与接收模块跟显示屏说明 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.?Uno板連接接收模塊與發射模塊

1.1接線說明

接收模塊 ??Uno

GND ------------GND接地線

VCC -------------5V接電源

數據引腳------11引腳(此例子接法)

?

?

發射模塊 ??Uno

GND ------------GND接地線

VCC -------------5V接電源

數據引腳------12引腳(此例子接法)

?

1.2測試代碼

接收模塊代碼:

#include <VirtualWire.h>

#undef int

#undef abs

#undef double

#undef float

#undef round

?

?byte buf[VW_MAX_MESSAGE_LEN];

?byte buflen = VW_MAX_MESSAGE_LEN;

void setup()

{

???Serial.begin(9600); ?// Debugging only

???Serial.println("setup");

???Serial.println("Receiver...");

???// Initialise the IO and ISR

???vw_set_ptt_inverted(true); // Required for DR3100

???vw_setup(2000); ??// Bits per sec

???vw_rx_start(); ??????// Start the receiver PLL running

}

void loop()

{

?

???if (vw_get_message(buf, &buflen))//Non-blocking

??{

???int i;

???digitalWrite(12, true); ?//Flash a light to show received good message

???Serial.print("Got: "); //Message with a good checksum received, dump it.

???for (i = 0; i < buflen; i++)

??{

???Serial.print(buf[i], HEX);

???Serial.print(" ");

????}

???Serial.println("");

???digitalWrite(12, false);

???}

???}

?

?

?

發射模塊代碼:

#include <VirtualWire.h>

#undef int

#undef abs

#undef double

#undef float

#undef round

void setup()

{

???Serial.begin(9600); ???// Debugging only

???Serial.println("setup");

???Serial.println("Transmmiter...");

???// Initialise the IO and ISR

???vw_set_ptt_inverted(true); // Required for DR3100

???vw_setup(2000); ??// Bits per sec

}

void loop()

{

???const char *msg = "hello";

???digitalWrite(13, true); // Flash a light to show transmitting

???vw_send((uint8_t *)msg, strlen(msg));

???vw_wait_tx(); // Wait until the whole message is gone

???digitalWrite(13, false);

???delay(200);

???}

?

?

?

2.?Uno板連接顯示器

2.1 接線說明

?

2.2 測試代碼

2.2.1英文顯示屏測試代碼

//LingShun lab ?

#include <Wire.h> ??

#include <LiquidCrystal_I2C.h> //引用I2C庫 ?

??

//設置LCD1602設備地址,這里的地址是0x3F,一般是0x20,或者0x27,具體看模塊手冊 ?

LiquidCrystal_I2C lcd(0x3F,16,2); ???

?

??

void setup() ?

{ ?

??lcd.init(); ?????????????????// 初始化LCD ?

??lcd.backlight(); ????????????//設置LCD背景等亮 ?

} ?

??

void loop() ?

{

??lcd.setCursor(0,0); ???????????????//設置顯示指針 ?

??lcd.print("Hello Wzx!!!"); ????//輸出字符到LCD1602

??int ButtonState = digitalRead(0); //設置變量存儲讀到的狀態值 ?

??//lcd.clear();

??delay(1000); ?

}

?

?

?

2.2.2中文顯示屏測試代碼

#include <RSCG12864B.h>//引用庫文件

void setup() {
?? // put your setup code here, to run once:
?? RSCG12864B.begin();//串口初始化
?? RSCG12864B.brightness(255);//屏幕亮度
}

void loop() {
?? // put your main code here, to run repeatedly:
?? unsigned char i;
?? char chn[]={? 0xD6, 0xD0,0xB1, 0xB4,0xCB, 0xB9,0xCC, 0xD8,0,};//中貝斯特
?? char f1[]={0X49,0X32,0X43,0XBD,0XD3,0XBF,0XDA,0X2C,0XC4,0XDA,0XBD,0XA8,0XD7,0XD6,0XBF,0XE2,0,};
?? char f2[]={0XD6,0XD0,0XCE,0XC4,0X2C,0XBA,0XAB,0XCE,0XC4,0X2C,0XC8,0XD5,0XCE,0XC4,0,};
?? char f3[]={0XD6,0XA7,0XB3,0XD6,0X32,0X44,0XBB,0XE6,0XCD,0XBC,0};//顯示文字
?? RSCG12864B.display_bmp(0);//顯示圖片
?? delay(800);
?? RSCG12864B.display_bmp(1);
?? delay(800);
?? RSCG12864B.display_bmp(2);
?? delay(800);
?? RSCG12864B.display_bmp(3);
?? delay(800);
?? RSCG12864B.display_bmp(4);
?? delay(800);
?? RSCG12864B.display_bmp(5);//通過圖片下載工具放置0-5bmp圖片
?? delay(800);
?? RSCG12864B.clear();//屏幕清屏
?? RSCG12864B.print_string_16_xy(0,15,chn);//坐標0,15,顯示chn里的內容
?? RSCG12864B.print_string_16_xy(8,35,"zhongbest.com");//顯示zhongbest.com
?? delay(3000);
?? RSCG12864B.clear();
?? RSCG12864B.print_string_12_xy(16,15,chn);//坐標16,15,顯示chn里的內容
?? RSCG12864B.print_string_12_xy(20,35,"zhongbest.com");//顯示zhongbest.com
?? delay(3000);
?? RSCG12864B.clear();
?? RSCG12864B.font_revers_on();
?? RSCG12864B.print_string_12_xy(25,0,"Built-in font");
?? RSCG12864B.font_revers_off();
?? RSCG12864B.print_string_5x7_xy(3,15,"5*7 ASCII 0123456789");
?? RSCG12864B.print_string_5x7_xy(3,25,"5*7 ASCII ABCDEabcde");
?? RSCG12864B.print_string_12_xy(20,35,"6*12/12*12 FONT");
?? RSCG12864B.print_string_16_xy(5,48,"8*16/16*16 FONT");//顯示內容
?? delay(3000);
?? RSCG12864B.clear();
?? RSCG12864B.print_string_16_xy(0,0,f1);//定義f1起始坐標0,0
?? RSCG12864B.print_string_16_xy(0,16,f2);//定義f2起始坐標0,16
?? RSCG12864B.print_string_16_xy(0,32,f3);
?? RSCG12864B.draw_rectangle(0,50,127,63);
?? for(i=2;i<=125;i++)
?? {
???? RSCG12864B.draw_fill_rectangle(2,52,i,61);
???? delay(100);
?? }
?? delay(3000);
}

?

?

總結

以上是生活随笔為你收集整理的arduinoUno连接发射模块与接收模块跟显示屏说明的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。