G'DAY
i have built 2 transceivers that work, i would like to add an LED to one and a BUZZER to the other,
i need to program them so when they receive a msg the accessories actvate, LED lights up when msg received and BUZZER sounds when the other receives the msg.
i have searched for hrs and tried to add and remove sketches for days
what code do i add.
any help would be greatly appreciated
my coding is as follows
#include <SPI.h>
#include "RF24.h"
char msg[27] = "Hello Nathan How Are You!";
char rec[27];
const uint64_t pipe[1] = {0xF0F0F0F0E1LL};
RF24 radio(9, 10);
void setup()
// put your setup code here, to run once:
{
Serial.begin(115200);
radio.begin();
radio.enableAckPayload();
radio.enableDynamicPayloads();
radio.setRetries(15, 15);
radio.openWritingPipe(pipe[0]);
}
void loop()
{
Serial.println("TX MILLS: " + String(millis()));
if (radio.write(msg, sizeof(msg)))
{
Serial.print("TX: ");
Serial.println( msg );
if (radio.isAckPayloadAvailable())
{
radio.read(&rec, 27);
Serial.print("RX: ");
Serial.println(rec);
}
else
{
Serial.println("No ACK Received...");
}
}
else
{
Serial.println("Cannot Transmit...");
}
delay(1000);
}
Welcome to the forum
nathan90:
my coding is as follows
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
See also FAQ - Arduino Forum for general rules on forum behaviour and etiquette.
Hello,
Welcome to the Arduino Forum.
This guide explains how to get the best out of this forum. Please read and follow the instructions below.
Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is fru…
I note that you have only posted a single sketch rather than two, one for the transmitter and one for the receiver
sorry. the other unit is this
#include <SPI.h>
#include "RF24.h"
char msg[27] = "Im Well Thank You !";
char rec[27];
const uint64_t pipe[1] = {0xF0F0F0F0E1LL};
RF24 radio(9,10);
void setup()
// put your setup code here, to run once:
{
Serial.begin(115200);
radio.begin();
radio.enableAckPayload();
radio.enableDynamicPayloads();
radio.setRetries(15, 15);
radio.openReadingPipe(1, pipe[0]);
radio.startListening();
}
void loop()
{
Serial.println("RX MILLIS: " + String(millis()));
if (radio.available())
{
radio.read(&rec, sizeof(rec));
Serial.print("RX: ");
Serial.println(rec);
radio.writeAckPayload(1, msg, sizeof(msg));
Serial.print("TX: ");
Serial.println(msg);
}
delay(500);
}
nathan90:
the other unit is this
Still without code tags I see
system
Closed
September 2, 2022, 8:28am
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.