Hi,
I'm trying to compile the following code, but I'm getting an error message saying "no matching function for call to RFID::RFID()"
Can someone help me with this?
Thanks
#include <SPI.h>
#include <Ethernet.h>
#include <DeviceBitTcpClient.h>
#include <EEPROM.h>
#include <dht11.h>
#include "NRF24L01.h"
#include "rfid1.h"
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <avr/interrupt.h>
//Common data types macro definition
#define uint8 unsigned char
#define uint16 unsigned int
#define uint32 unsigned long
//Library configuration
DHT11 DHT11;//Creates a variable of type DHT11,named DHT11
RFID1 rfid; //Creates a variable of type RFID1,named rfid
uchar serNum[5];
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);//
#define TX_ADR_WIDTH 5 // 5 unsigned chars TX(RX) address width
#define TX_PLOAD_WIDTH 3 // 32 unsigned chars TX payload
unsigned char TX_ADDRESS[TX_ADR_WIDTH] =
{
0x34,0x43,0x10,0x10,0x01
}; // Define a static TX address
unsigned char rx_buf[TX_PLOAD_WIDTH] = {0}; // initialize value
uint8 tx_buf[TX_PLOAD_WIDTH] = {0};
#define LW_USERKEY "415c903f35bb4baeb3fc7640b5fd2e11" // USEEKEY
#define LW_GATEWAY "01" // User gateway Numbers
DeviceBitTcpClient *client; //Creates a variable of type DeviceBitTcpClient,named client
int postInterval = 10000;//the delay time between the data upload to the devicebit
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop
const unsigned long postingInterval = 30*1000; //delay between updates to cosm.com
unsigned long duration;
unsigned long starttime;//store the time the timer
unsigned long sampletime_ms = 10000;
unsigned long lowpulseoccupancy = 0;
float ratio = 0;
double concentration = 0;
#define p0 101325 // Pressure at sea level (Pa) p0 = 101325;
#define currentAltitude 8 // current altitude in METERS
const float epressure = p0 * pow((1-currentAltitude/44330), 5.255); // expected pressure (in Pa) at altitude
#define BMP085_ADDRESS 0x77 // I2C address of BMP085
const unsigned char OSS = 0; // Oversampling Setting
float pressure = 0;//initialize the value of pressure
float temperature = 0;//initialize the value of temperature
float altitude = 0;//initialize the value of temperature
char weather;
#define DELAYTIME 1000 //the time between every sensor's data read
#define F_CPU 16000000 //the Crystal Oscillator frequency is 16MHZ
#define F_DIV 1024
#define TIME 0.1
volatile uint8 count1,count2 = 0; //store temporary data
// Calibration values
int ac1; int ac2; int ac3;
uint16 ac4; uint16 ac5; uint16 ac6;
int b1; int b2;
int mb; int mc; int md;
// b5 is calculated in bmp085GetTemperature(...), this variable is also used in bmp085GetPressure(...)
// so ...Temperature(...) must be called before ...Pressure(...).
long b5;
uint8 pirValue = 0;
boolean pirState = false;
uint8 rfidValue = 0;
boolean rfidState = false;
// pins distribution
#define photocellPin A0 //photoresistor connect to A0
#define mq2Pin A1 //mq2 connect to A1
#define light1Pin 8 //Set the control operation of I/o port
#define light2Pin 9
#define pirPin 36 //pir connect to pin36
#define DHT11PIN 34 //dht11 connect to pin34
#define rfidLED 38 //rfid signal led connnect to pin38
#define pirLED 40 //pir signal led connect to pin40
void setup()
{
Serial.begin(9600);//set the baudrate of serial monitor is 9600
if (!bmp.begin())
{
Serial.println("Could not find a valid BMP085 sensor, check wiring!");
//while (1);
}
//Wire.begin();
//calibration();
rfid.begin(7, 5, 4, 3, 6, 2);//begin(uchar irqPin, uchar sckPin, uchar mosiPin, uchar misoPin, uchar ssnPin, uchar rst)
delay(100);
rfid.init();
pinMode(pirPin, INPUT);
pinMode(rfidLED, OUTPUT);
pinMode(pirLED, OUTPUT);
pinMode(CE, OUTPUT);
pinMode(SCK_PIN, OUTPUT);
pinMode(CSN, OUTPUT);
pinMode(MOSI_PIN, OUTPUT);
pinMode(MISO_PIN, INPUT);
pinMode(IRQ, INPUT);
init_io(); // Initialize IO port
unsigned char status=SPI_Read(STATUS);
Serial.print("status = ");
Serial.println(status,HEX); // There is read the mode’s status register, the default value should be ‘E’
Serial.println("TX_Mode Start*********");
TX_Mode();
TIMER1_init();
client = new DeviceBitTcpClient(LW_USERKEY, LW_GATEWAY);
//client = new LeweiTcpClient(LW_USERKEY, LW_GATEWAY,mac,ip,mydns,gw,subnet);
UserSwitch us1(switchLight1,"light1",1);
client->addUserSwitch(us1);
UserSwitch us2(switchLight2,"light2",1);
client->addUserSwitch(us2);
UserSwitch us3(switchLight3,"light3",1);
client->addUserSwitch(us3);
UserSwitch us4(switchLight4,"light4",1);
client->addUserSwitch(us4);
starttime = millis();
pinMode(light1Pin,OUTPUT);
pinMode(light2Pin,OUTPUT);
}
void loop()
{
//long pressure = 0;
//float altitude = 0;
client->keepOnline();
if ((millis()-starttime) > postInterval)
{
//humiture
dhtPreprocess();
client -> appendSensorValue("Humidity", DHT11.humidity);
delay(DELAYTIME);
client -> appendSensorValue("Temperature", DHT11.temperature);
delay(DELAYTIME);
//illumination intensity
client -> appendSensorValue("Light",analogRead(photocellPin));
delay(DELAYTIME);
//gas sensor
client -> appendSensorValue("Gas",analogRead(mq2Pin));
delay(DELAYTIME);
//long pressure = 0;
//float altitude = 0;
//getBmpData(&pressure, &altitude);
//int pressureInt = (int)pressure;
readBmp();
client -> appendSensorValue("Pressure", pressure);
delay(DELAYTIME);
client -> appendSensorValue("Altitude",weather);
delay(DELAYTIME);
//PIR
client->appendSensorValue("PIR",pirValue);
delay(DELAYTIME);
//RFID
client->sendSensorValue("RFID",rfidValue);
delay(DELAYTIME);
Serial.println("repeat lwc->send ...Completed.");
starttime = millis();
}
}