首页 > 解决方案 > Raspberry Pi 4 上 RF24 的初始设置

问题描述

我对树莓派还很陌生,但我已经涉足 arduino 有一段时间了,我正试图让它们使用 nRF24L01 通信模块相互通信。我使用了 https://nrf24.github.io/RF24/md_docs_linux_install.html上的说明

Install prerequisites if there are any (MRAA, LittleWire libraries, setup SPI device etc)
Download the install.sh file from http://tmrh20.github.io/RF24Installer/RPi/install.sh
wget http://tmrh20.github.io/RF24Installer/RPi/install.sh
Make it executable
chmod +x install.sh
Run it and choose your options
./install.sh
Run an example from one of the libraries
cd rf24libs/RF24/examples_linux
Edit the gettingstarted example, to set your pin configuration
nano gettingstarted.cpp
make
sudo ./gettingstarted

我在树莓派上启用了 SPI,在安装它时,我可以选择使用 SPIDEV,我发现我需要使用它来设置它

./configure --driver=SPIDEV;make;sudo make install

但我找不到cd更改该配置所需的位置。

我假设这是我搞砸的步骤,因为当我

nano gettingstarted.cpp

并检查

rf24(22,0)

接着

make
sudo ./gettingstarted

我不断收到有关 SPIException 或无线电不工作的错误。

这是我的接线图……你在这张照片中看不到 nRF24L01,但所有这些引线都通向它。是的,我有一个大小合适的电容器,我的电压表显示我有一个稳定的 3.7 伏电压连接到收音机。 pi 接线

使用下面的引脚图,我使用了以下

MOSI -19
MISO -21
SCLK -23
CSN  -24
CE   -11 OR 22 
**(I switched to 22 because I read that it was the default to go to)**
VCC  -1
GND  -6

pi 引出线

拜托,我真的只想让这个收音机工作。有人可以逐步说明我如何才能让 RF24 在树莓派 4 上工作吗?

标签: raspberry-pi4

解决方案


推荐阅读