Why did my while(1) not halt the device?

Hi guys, new particle developer here :slight_smile:

Sorry for what I know is going to be an absolutely noob question… but…

I put a while(1); loop in my firmware (using VS Code and flashing via serial USB). It did halt the execution of my code, but the DeviceOS still ran. What’s going on there then?



What do you mean with device OS still running?
How does your code look?

As in the LED on the Argon kept breathing, which means my while(1) didn’t lock the system up. My code is as follows:

void loop() {
  pressureSensor pressureSensor_c;  //_c for class recognition

  float mVolts = pressureSensor_c.getVoltage()*1000;
  Serial.print("ADC Voltage = ");
  Serial.print(mVolts, 3); // second arg for force precision

  String voltage_str = String(mVolts, 3);
  while(1);    //this while(1) doesn't halt the device, as the RGB LED kept breathing

Your while(1); cannot intercept interrupts and FreeRTOS will also run threads that are independent of the application thread.

Thanks ScruffR. Is there a way that I can monitor resources easily? Number of threads running etc?