hello everyone
im using protocentral-pulse-express with arduino MEGA and Nextion display (ENHANCED NX4832K035)
i setup the code to display the output of the sensor to the display and it works well
but i have to open serial monitor every time i need to display the output of the sensor
i want to add power supply and use the sensor and the display without the computer but opening the serial monitor.
this it my code
#include <Wire.h>
#include "max32664.h"
#define RESET_PIN 04
#define MFIO_PIN 02
#define RAWDATA_BUFFLEN 250
max32664 MAX32664(RESET_PIN, MFIO_PIN, RAWDATA_BUFFLEN);
void mfioInterruptHndlr(){
//Serial.println("i");
}
void enableInterruptPin(){
//pinMode(mfioPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(MAX32664.mfioPin), mfioInterruptHndlr, FALLING);
}
void loadAlgomodeParameters(){
algomodeInitialiser algoParameters;
algoParameters.calibValSys[0] = 120;
algoParameters.calibValSys[1] = 122;
algoParameters.calibValSys[2] = 125;
algoParameters.calibValDia[0] = 80;
algoParameters.calibValDia[1] = 81;
algoParameters.calibValDia[2] = 82;
algoParameters.spo2CalibCoefA = 1.5958422;
algoParameters.spo2CalibCoefB = -34.659664;
algoParameters.spo2CalibCoefC = 112.68987;
MAX32664.loadAlgorithmParameters(&algoParameters);
}
void setup(){
Serial.begin(9600);
Wire.begin();
loadAlgomodeParameters();
int result = MAX32664.hubBegin();
if (result == CMD_SUCCESS){
Serial.println("Sensorhub begin!");
}else{
//stay here.
while(1){
Serial.println("Could not communicate with the sensor! please make proper connections");
delay(5000);
}
}
bool ret = MAX32664.startBPTcalibration();
while(!ret){
delay(10000);
Serial.println("failed calib, please retsart");
//ret = MAX32664.startBPTcalibration();
}
delay(1000);
//Serial.println("start in estimation mode");
ret = MAX32664.configAlgoInEstimationMode();
while(!ret){
//Serial.println("failed est mode");
ret = MAX32664.configAlgoInEstimationMode();
delay(10000);
}
//MAX32664.enableInterruptPin();
Serial.println("Getting the device ready..");
delay(1000);
}
void loop(){
uint8_t num_samples = MAX32664.readSamples();
if(num_samples){
//Serial.print("sys = ");
Serial.print("sys.val=");
Serial.print(MAX32664.max32664Output.sys);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", dia = ");
Serial.print("dia.val=");
Serial.print(MAX32664.max32664Output.dia);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
//Serial.print(", hr = ");
Serial.print("hr.val=");
Serial.print(MAX32664.max32664Output.hr);
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
float sop2f = float(MAX32664.max32664Output.spo2);
//Serial.print(" spo2 = ");
Serial.print("spo2.txt=\"");
Serial.print(sop2f);
Serial.print("\"");
Serial.write(0xff);
Serial.write(0xff);
Serial.write(0xff);
}
delay(100);
}