Max 30100 Final
Max 30100 Final
h>
#include <ESP8266WiFi.h> // Include ESP8266 library
#include <ESP8266WebServer.h>
#include <Wire.h>
#include "MAX30100_PulseOximeter.h"
#define REPORTING_PERIOD_MS 1000
const char* ssid = "xxxxxxxxxx";
const char* password = "xxxxxxxxxx";
WiFiClient client;
unsigned long myChannelNumber = xxxxxx;
const char * myWriteAPIKey = "xxxxxxxxxxxxxx";
uint8_t aq=0;
PulseOximeter pox;
uint32_t tsLastReport = 0;
void onBeatDetected()
{
Serial.println("Beat!");
}
void setup()
{
Serial.begin(115200);
pox.begin();
// The default current for the IR LED is 50mA and it could be changed
// by uncommenting the following line. Check MAX30100_Registers.h for all the
// available options.
// pox.setIRLedCurrent(MAX30100_LED_CURR_7_6MA);
tsLastReport = millis();
}
// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to
store up to 8 different
// pieces of information in a channel. Here, we write to field 1.
if( data_state )
{
ThingSpeak.writeField(myChannelNumber, 4, aq, myWriteAPIKey);
data_state = false;
}
else
{
data_state = true;
}
delay(5000); // ThingSpeak will only accept updates every 5 seconds.
}