I don't know how to fix this error. can someone help?

Hi, I’m new to coding and I am working on a project that uses nano, an OLED screen, and a pulse sensor. I tried to save and verify the code on the Arduino Create Chromebook app, but I got an error and I can’t find anything on how to fix it. The error says “collect2: error: ld returned 1 exit status” The others are "tmp/ccAZcs2b.ltrans0.ltrans.o: In function `main’:

/home/builder/.arduino15/packages/arduino/hardware/avr/1.8.2/cores/arduino/main.cpp:46: undefined reference to `loop’

collect2: error: ld returned 1 exit status

exit status 1"

#define USE_ARDUINO_INTERRUPTS true   
#include <PulseSensorPlayground.h>   


//  Variables
const int PulseWire = 0;      
const int LED13 = 13;          
int Threshold = 550;          
PulseSensorPlayground pulseSensor;  

void setup()  {  

  Serial.begin(9600); 

  // Configure the PulseSensor object, by assigning our variables to it. 
  pulseSensor.analogInput(PulseWire);   
  pulseSensor.blinkOnPulse(LED13);       
  pulseSensor.setThreshold(Threshold);   
int bpm = pulseSensor.getBeatsPerMinute();
  // Double-check the "pulseSensor" object was created and "began" seeing a signal. 
if (pulseSensor.begin()) {
Serial.println("Welcome!");  //This prints one time at Arduino power-up,  or on Arduino reset.  
  }
  
if (bpm<100){

if (pulseSensor.sawStartOfBeat()) {            
 Serial.print("BPM: "); 
 Serial.println(bpm);
}
}

if (bpm>99){
Serial.print("everything is ok");
Serial.print("the screen will show some prompts");
Serial.print("try to follow along");

//here we go gays- i mean guys//
Serial.print("Breathe in for 5 counts");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("Now hold your breath for seven counts");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("6");
Serial.print("7");
Serial.print("Breathe out for 5 counts");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("Now hold for 7 again");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("6");
Serial.print("7");
Serial.print("Remember that everything is okay");
Serial.print("Lets keep breathing");
Serial.print("Breathe in for 5 counts");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("Now hold your breath for seven counts");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("6");
Serial.print("7");
Serial.print("Breathe out for 5 counts");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("Now hold for 7 again");
Serial.print("1");
Serial.print("2");
Serial.print("3");
Serial.print("4");
Serial.print("5");
Serial.print("6");
Serial.print("7");
  
  
}

}

I am completely lost right now and I’d really appreciate some help : ) Have a nice day : D (sorry if I did this wrong)

That's the final error message. There were others above it that will give the specifics of what was wrong. We will need to see those to help.

You have no loop() section.

The loop() function is requires if you use setup(). If your sketch doesn't have anything to do after setup(), add an empty loop() function:

void loop() {}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.