Hi!
Im doing a project. I want to send data from Pulse sensor to my database. Pulse sensor is working good same as database but i cant connect this two things. Im posting my code, my bug and code that im using as a base for my code.
This is my code :
#include <PulseSensorPlayground.h>
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //Setting MAC Address
#define USE_ARDUINO_INTERRUPTS true
const int PulseWire = 0;
int Threshold = 513;
PulseSensorPlayground pulseSensor;
float pulsData;
char server[] = "192.168.1.162";
IPAddress ip(192,168,1,163);
EthernetClient client;
/* Setup for Ethernet and RFID */
void setup() {
Serial.begin(9600);
pulseSensor.analogInput(PulseWire);
pulseSensor.setThreshold(Threshold);
pulseSensor.begin();
// if (Ethernet.begin(mac) == 0) {
// Serial.println("Failed to configure Ethernet using DHCP");
// Ethernet.begin(mac, ip);
// }
}
//------------------------------------------------------------------------------
/* Infinite Loop */
void loop(){
delay(1000);
int myBPM = pulseSensor.getBeatsPerMinute();
if (pulseSensor.sawStartOfBeat()) {
Serial.println("♥ A HeartBeat Happened ! ");
Serial.print("BPM: ");
Serial.println(myBPM);
}
Sending_To_phpmyadmindatabase();
delay(30000); // interval
}
void Sending_To_phpmyadmindatabase() //CONNECTING WITH MYSQL
{
if (client.connect(server, 80)) {
Serial.println("connected");
// Make a HTTP request:
Serial.print("GET /kod/skrypt.php?puls=");
client.print("GET /kod/skrypt.php?puls="); //YOUR URL
Serial.println(pulsData);
client.print(pulsData);
client.print(" "); //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.println();
client.println("Host: 192.168.1.162");
client.println("Connection: close");
client.println();
} else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
This is my bug:
Arduino:1.8.13 (Windows Store 1.8.39.0) (Windows 10), Płytka:"Arduino Uno"
C:\Users\Acer\AppData\Local\Temp\ccgva8RR.ltrans0.ltrans.o: In function `begin':
C:\Users\Acer\Documents\Arduino\libraries\PulseSensor_Playground\src/PulseSensorPlayground.cpp:56: undefined reference to `PulseSensorPlayground::UsingInterrupts'
C:\Users\Acer\Documents\Arduino\libraries\PulseSensor_Playground\src/PulseSensorPlayground.cpp:57: undefined reference to `PulseSensorPlaygroundSetupInterrupt()'
collect2.exe: error: ld returned 1 exit status
exit status 1
Błąd kompilacji dla płytki Arduino Uno.
Ten raport powinien zawierać więcej informacji jeśli w
File -> Preferencje zostanie włączona opcja "Pokaż
szczegółowe informacje podczas kompilacji"
and this is the working code but not for my sensor :
Pls help me guys I really dont know what im doing wrong and i cant move on.