Hello everybody i want to send ecg data from ad8232(sparkfun module) from one arduino to another arduino with nrf24L01 but it seems didnt work
Here is my code work fro transmitter and receiver
btw i use rf24 library from starter-kit.nettigo.eu/2014/connecting-and-programming-nrf24l01-with-arduino-and-other-boards/
Thanks for your help
Here is my code for transmitter
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8);
const byte rxAddr[6] = "00001";
int gagal[1];
int data[2];
void setup()
{
radio.begin();
radio.setRetries(15, 15);
radio.openWritingPipe(rxAddr);
radio.stopListening();
Serial.begin(9600);
pinMode(10, INPUT); // Setup for leads off detection LO +
pinMode(11, INPUT); // Setup for leads off detection LO -
}
void loop()
{
if((digitalRead(10) == 0)||(digitalRead(11) == 0)){
// send the value of analog input 0:
int a= analogRead(A0);
radio.write(&a, sizeof(a));
Serial.println(a);
}
}
and receiver
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7,8);
int data;
const byte rxAddr[6]="00001";
void setup()
{
while(!Serial);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0,rxAddr);
radio.startListening();
}
void loop()
{
if(radio.available())
{
int a;
radio.read(&a,sizeof(a));
Serial.println(a);
}
}