Boron Sleep Mode

Hi All,

i am trying to use sleep mode function to my code, but seems it doesn’t like my code, it flashing Magenta after sending data instead of going sleep.
i want to make the boron to sleep for 10 min then wake send me the signal then back,
can you please check if i miss something here in the code below? it used to work perfect on particle electron

const uint32_t msSAMPLE_INTERVAL = 2500;
const uint32_t msMETRIC_PUBLISH  = 5000;

uint32_t msLastMetric;
uint32_t msLastSample;

void setup() {
  // initialize serial communication:
  pinMode(pump_pin, OUTPUT);

void loop {
  float duration, inches, cm;

  // The sensor is triggered by a HIGH pulse of 10 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(trigPin, OUTPUT);
  digitalWrite(trigPin, LOW);

  digitalWrite(trigPin, HIGH);
  digitalWrite(trigPin, LOW);

  // Read the signal from the sensor: a HIGH pulse whose
  // duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(echoPin, INPUT);
  duration = pulseIn(echoPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);
  xx= cm;
  Serial.print("in, ");
  float l = samples.getLowest();
  float m = samples.getMedian();
  float a = samples.getAverage();
  float h = samples.getHighest();
 // lowest =l;
  average = a;
  median = m;
  if (millis() - msLastMetric >= msMETRIC_PUBLISH){

Apart from the suggestions you got about a month ago in another thread but haven’t applied yet

You may want to have a look at the docs

Where it states

And at the top of the “classic sleep” reference you also see a link to the modern way of doing it.

We also cannot see what pumpactivator() does, so this might also contribute to your issue.


Thanks a lot, I’ve changed the pinMode() , also the sleeping Mode is working after i added this to the code :

SystemSleepConfiguration config;
.gpio(WKP, RISING)

1 Like

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