Getting expected unqualified-id before '.' token for class testlib.setup_system() and testlib.looping_system
Help me please with the codes
header file
#ifndef testlib_h
#define testlib_h
#include <inttypes.h>
#include <Arduino.h>
class testlib
{
public:
void setup_system();
void looping_system();
private:
};
#endif
cpp file
#include <inttypes.h>
#include <Wire.h>
#include <Arduino.h>
#include <SHT2x.h>
#include <Ethernet.h>
#include <SPI.h>
#include "testlib.h"
void testlib::setup_system()
{
IPAddress ip(192, 168, 1, 129);
EthernetClient client;
EthernetServer server(80);
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //Setting MAC Address
if (Ethernet.begin(mac) == 0)
{
}
else
{
Ethernet.begin(mac, ip);
server.begin();
}
// delay(1000);
}
void testlib::looping_system()
{
float humidityData;
float temperatureData;
IPAddress ip(192, 168, 1, 129);
EthernetServer server(80);
EthernetClient client = server.available();
humidityData = (SHT2x.GetHumidity());
temperatureData = (SHT2x.GetTemperature());
// listen for incoming clients
if (client) {
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the http request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard http response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of sensor data
client.print("temperature value is: ");
client.print(temperatureData);
client.println("humidity value is: ");
client.print(humidityData);
client.println("
");
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
}
}
and ino code
#include "testlib.h"
#include "Wire.h"
#include "testlib.h"
#include "Wire.h"
void setup() {
Serial.begin(9600);
Wire.begin();
testlib.setup_system();
}
void loop() {
testlib.looping_system();
stuck for two days
error details:
\Documents\Arduino\libraries\testlib\testlib\testlib.ino: In function 'void setup()':
testlib:8:10: error: expected unqualified-id before '.' token
testlib.setup_system();
^
\Documents\Arduino\libraries\testlib\testlib\testlib.ino: In function 'void loop()':
testlib:13:10: error: expected unqualified-id before '.' token
testlib.looping_system();
testlib.cpp (2.53 KB)
testlib.h (220 Bytes)
testlib.ino (182 Bytes)