Hello everyone,
I am making a project where i have two arduino duemilanove boards. One acting as a server connected to a nrf24l01 transciever (ce= 9, csn=8) and the other acting as a client connected to a nrf24l01 transciever (ce= 9 , csn=8) and a dht11 temp/humid sensor. My goal is to gather data on the client end and transmit it to the server. Then display the data on the server port monitor i.e values of temperature and humidity that is detected by the client arduino. The second step of the project is to reduce power consumption by the client and make it run on 3v batteries . I am stuck on the phase where i need to display the data received from the client end on the server port monitor. Below is the code for my client. Can anyone help me with the server code. as to what i need to do in order to get the server monitor display the humidity and temperature values. thank you
//client
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>
#include "DHT.h"
#define DHTPIN 4
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
int powerpin = 5;
int datapin = 4;
int gndpin = 2;
void setup(){
Serial.begin(9600);
digitalWrite(powerpin, HIGH);
digitalWrite(gndpin, LOW);
pinMode(gndpin, OUTPUT);
pinMode(powerpin, OUTPUT);
pinMode(datapin, INPUT);
Serial.println("DHT11 Gathering information!");
dht.begin();
Mirf.csnPin = 8;
Mirf.cePin = 9;
Mirf.spi = &MirfHardwareSpi;
Mirf.init();
Mirf.setRADDR((byte *)"Clynt");
Mirf.setTADDR((byte *)"Servr");
Mirf.payload = sizeof(unsigned long);
Mirf.config();
Serial.println("Beginning ... ");
}
void loop()
{
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(t) || isnan(h)) {
Serial.println("Failed to read from DHT");
} else {
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
}
Mirf.send((byte *) &h);
Mirf.send((byte *) &t);
while(Mirf.isSending()){
}
Serial.println("Finished sending");
delay(5000);
}