Pulse sensor timer conflict (Argon)

Hey All,

I’ve been trying to configure code that will place my WiFi module to sleep but continue running the code that I have put in place. In order to achieve this I have needed to use a software timer library. I have coded it so that it would keep the WiFi module off for a period of time, but as soon as I try to use my pulse sensor the WiFi does not turn on anymore. At least from my understanding, it seems to have to do with the software timer that is in the Pulse sensor library and it disrupting the timer from my main code. I’m not entirely sure what to do, since I’m still very new to all of this.

Since i’m using an Argon, I had to use this code from a different thread that I found

Not sure if this will be to confusing or not but this is my code that I have:

//  Where the Magic Happens
void loop(){

    Serial.println("Start of code");
	if (QS == true){     //  A Heartbeat Was Found
		fadeRate = 255;
		bpm_latest = BPM; // this is storin the current BPM from the sensors code
		QS = false;                      // reset the Quantified Self flag for next time 
	else { 
	    digitalWrite(blinkPin,LOW);            // There is not beat, turn off pin 13 LED
	Hum =  dht.getHumidity(); // Humidity 
	temp_sensor = dht.getTempCelcius(); // Temperature
	if(timer.expired()||setting_up == true){
	    	Serial.println("entered the if statement");

	Serial.println("End Of Code");


///////// Sending data to the SQL server

bool wifi_check(){
    boolean wifi = WiFi.ready();
    Serial.println("checked Wifi");
    if (wifi == false ){
        Serial.println("WIFI was off");
        setting_up = true;
        setting_up = false;
    return setting_up;

void energy_saving_mode(){
    Serial.println("sendin data");
    send_data();//Send Data 
    Serial.println("goingg it too sleep mode");
    System.sleep(30);//Place the sleep module into sleep
    Serial.println("after sleep mode");
    timer.start();// Start the timer
    Serial.println("starting timer");

void send_data(){
        sprintf(thedata, "%s%s%d%s%d%s%d", thepath, var, bpm_latest, temp_var, temp_sensor, hum_var, Hum);
        request.path = thedata;
         // Get request
        http.get(request, response, headers);

@darknight1011, can you share your entire app?

Yes I can :grinning:,

That link is dead.

I’d not call the sleep function from a timer and your noInterrupts() in PulseSensor may interfere with the system interrupts.