fnb111
2
//transmitter_ASC basic
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(6,7); //CE, CSN pins RF24L01
const byte rxAddr[6] = "00001";
const int analogIn = A0; //ASC758 connection
int mVperAmp = 20; // scale factor
int ACSoffset = 2500; //see bi directional offset
int RawValue = 0;
double Voltage = 0;
double Amps = 0;
void setup()
{
Serial.begin(9600);
radio.begin();
radio.setRetries(15, 5);//time,re tries
radio.openWritingPipe(rxAddr);
radio.stopListening();
}
void loop()
{
RawValue = analogRead(analogIn);
Voltage =(RawValue/1023.0)*5000; //gets mV
Amps =((Voltage-ACSoffset)/mVperAmp);
const char text[] = "Amps1 ="; // writes Amps1= to Rx unit
radio.write(&text, sizeof(text)); //check ())- its correct
//delay(50);
const char Amps[8];
radio.write (Amps, (sizeof Amps));
delay(3000);
}