Hey all, wondering if I could get some help, I seem to be stuck and have no idea where to go.
I'm trying to get an Attiny to communicate with an Esp8266 with an NRF24L01 so it can be part of an iot network and have the Esp act as sort of a wifi connected hub.
I've successfully managed to get an arduino uno to send data to the Esp with the radio modules in multiple ways, that's certain the Esp works.
But when I program an Attiny to do essentially the same exact thing, it just doesn't.
The code for the Attiny here
#define CE_PIN 3
#define CSN_PIN 4
#include "RF24.h"
RF24 radio(CE_PIN, CSN_PIN);
const byte addr[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(addr);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop(void){
const char text[] = "Hello World";
radio.write( &text, sizeof(text) );
delay(1000);
}
The code for the Esp is here
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(2, 15); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
}
The connections are as follows:
Attiny
NRF ATtiny
CSN -------------- 3
MOSI ------------- 6
MISO ------------- 5
SCK -------------- 7
CE --------------- 2
Esp8266 connections:
NRF ESP-12E
CSN ---------------- D8 AND 3.3k Ohm Resistor (mentioned here )
MOSI --------------- D7
MISO --------------- D6
SCK ---------------- D5
CE ------------------ D4
Also, the arduino uno code I used is this
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
}
I have the attiny and nrf powered by a 3.3v supply, when plugged in nothing happens, I've tried as well just getting the attiny to do a blink sketch, which works fine.
Thanks for anyone who can help or offer anything