Using the Dash class

alright. in the meantime, in case it won’t be out anytime soon, I will look for a real-time clock.

Is DS1307 compatible for the dash board?

Hey @tristy,

The DS1307 is likely compatible with the Dash. You might need to do some tweaking to get it to talk to the Dash on the appropriate pins.

Please let us know how it works out for you or if you run into any issues using the DS1307 with the Dash.

Thanks,
Logan

Is there any libraries needed to be included?

Does it have any libraries needed for using it with an Arduino? You would need to include those with a Dash as well.

I see that you have released the timed deep sleep. How long can it be used for because I need it to sleep for 12 hours and switch on for 15 minutes and back to sleep for 12 hours (repeatedly). Does the timer support these functions?

Yeah, you should be able to do that.

Alright thank you :slight_smile: Will try it out!

Great, have fun! These are the new functions. We’ll provide a little more info about them soon.

    void deepSleep() {lls(false);}

    void deepSleepSec(uint32_t sec);

    void deepSleepMin(uint32_t min);

    void deepSleepHour(uint32_t hour);

    void deepSleepDay(uint32_t day);

    void deepSleepAtMostSec(uint32_t sec);

    void deepSleepAtMostMin(uint32_t min);

    void deepSleepAtMostHour(uint32_t hour);

    void deepSleepAtMostDay(uint32_t day)

what is the difference between void deepSleepHour(uint32_t hour); and void deepSleepAtMostHour(uint32_t hour); ?

The AtMost functions will wake on timer or some other attached IO and the others will wake only on the timer.

Is it possible to combine the 3 deepSleepAtMost() functions together? We need to let it sleep for 1 hour 30 min 30 secs. If we do not combine the functions, we need to press the trigger 3 times to wake the dash pro up.

Is there a way to solve this problem?

@tristy

Hopefully this will work for you. If you call Dash.lastWakeupSource() after waking from deep sleep, you can see what event caused the wake-up. So if the timer expires, you’ll get 16. For GPIO pins, refer to the wake-up column of the pin diagram in the user manual. For example, pin R04 is wake-up source 14. You can use that to decide if you need to sleep again, or cancel on a button press. See the example sketch below:

void setup() {
  Dash.begin();                     //Enable the Dash class
  Serial2.begin(115200);            //Enable Serial2
  pinMode(R04, INPUT_PULLUP);       //Set R04 to input with a pull-up
  Dash.attachWakeup(R04, FALLING);  //Use R04 as a wake-up source (WU14)
                                    //Will generate a wake-up when transitioning
                                    //from high to low. Since R04 is pulled high
                                    //internally, grounding R04 will generate
                                    //the wake-up event
}

static uint32_t count = 1;

void loop() {
  Dash.onLED();              //LED is on while awake
  Serial2.print("Dash Timed Sleep At Most Demo Run ");
  Serial2.println(count);
  Serial2.println("Going to sleep for at most 10 seconds.");
  Serial2.waitToEmpty();     //before sleeping, clear the Serial output buffer
  Serial2.flush();           //clear the Serial input buffer for the next run 
  
  Dash.deepSleepAtMostSec(10);   //deep sleep 10 seconds, or until R04 goes low

  count++;                       //Awake now
  
  uint32_t source = Dash.lastWakeupSource();    //get the source of the last
                                                //wake-up event
  Serial2.print("Last wake-up source(");
  Serial2.print(source);
  Serial2.print("): ");
  Serial2.println(source == 16 ? "Timer" : "R04");                       
}

You can also check the bootloader version the Dash is running with
Serial.println(Dash.bootVersion());
The current version is 2.1.1, so that would print the string “2.1.1”.

Serial.println(Dash.bootVersionNumber(), HEX);
would print the number “20101”.