0
我有一個arduino傳輸器設置與nFR24L01 transever。當我嘗試在arduino mega和arduino uno之間發送數據時,串行監視器顯示垃圾。Arduino串行監視器傳輸數據時顯示垃圾
這裏是我的代碼:
兆:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CNS, CE
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World, tw";
radio.write(&text, sizeof(text));
delay(500);
radio.write("what about this?",15);
delay(500);
}
歐諾:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CNS, CE
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
delay(1000);
Serial.println("Hello to the world.");
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
//delay(1000);
if (radio.available()) {
char text[32] = "";
radio.read(&text, 15);
Serial.println(text);
}
}
My Scematic 提前感謝!
我們需要更多信息才能爲您提供幫助。你可以發佈你的設置的照片或原理圖嗎? – Drue
我在帖子中添加了一個示意圖。希望有所幫助。 –
傳輸工作正常。串口監控是問題 –