Habe etwas komisches festgestellt, als ich den NRF24L01 an einen Arduino Nano angeschlossen habe. Sobald der CE Pin vom NRF an den Pin 9 des Nanos angeschlossen wird, will dieser prompt nicht mehr senden, sobald man den jumper wieder rauszieht sendet er Einwandfrei. Nun frag ich mich woran das liegt, da dies ja sehr komisch ist. Außerdem habe ich einen 10µF Kondensator direkt am NRF zwischen Vin und GND.
Mein Code:
Sender:
/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <dht.h>
dht DHT;
#define DHT11_PIN 3
RF24 radio(9, 10);
int data[2];
void setup() /****** SETUP: RUNS ONCE ******/
{
radio.begin();
radio.setPALevel(RF24_PA_LOW);
radio.setChannel(0x4c);
// open pipe for writing
radio.openWritingPipe(0xF0F0F0F0E1LL);
radio.enableDynamicPayloads();
radio.setAutoAck(true);
radio.powerUp();
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
DHT.read11(DHT11_PIN);
data[0] = (int)DHT.humidity;
data[1] = (int)DHT.temperature;
radio.write( data, sizeof(data) );
delay(5000);
}//--(end main loop )---
/*-----( Declare User-written Functions )-----*/
//NONE
//*********( THE END )***********
Empfänger:
/*-----( Import needed libraries )-----*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
/*-----( Declare Constants and Pin Numbers )-----*/
#define CE_PIN 9
#define CSN_PIN 53
/*-----( Declare objects )-----*/
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/*-----( Declare Variables )-----*/
int data[2]; // 2 element array holding Joystick readings
void setup() /****** SETUP: RUNS ONCE ******/
{
Serial.begin(9600);
lcd.begin();
lcd.backlight();
lcd.println("Funk Thermometer");
radio.begin();
radio.setPALevel(RF24_PA_LOW);
radio.setChannel(0x4c);
// open pipe for reading
radio.openReadingPipe(1,0xF0F0F0F0E1LL);
radio.enableDynamicPayloads();
radio.setAutoAck(true);
radio.powerUp();
radio.startListening();
lcd.clear();
}//--(end setup )---
void loop() /****** LOOP: RUNS CONSTANTLY ******/
{
if ( radio.available() )
{
// Read the data payload until we've received everything
bool done = false;
while (!done)
{
// Fetch the data payload
done = radio.read( data, sizeof(data) );
Serial.print(data[0]);
Serial.print(" , ");
Serial.println(data[1]);
lcd.clear();
lcd.print(data[0]);
lcd.print("%, ");
lcd.setCursor(0,1);
lcd.print(data[1]);
lcd.print((char)223);
lcd.print("C");
}
}
}//--(end main loop )---
/*-----( Declare User-written Functions )-----*/
//NONE
//*********( THE END )***********