machine.idle vs machine.sleep

  • What is the difference between these calls? The docs only mention machine.idle, but help(machine) shows both.

  • @robert-hh Aha! That explains it. By the way, is that code you're showing available to look at somewhere (having it would probably answer a lot of questions and cut down on stupid questions)?

  • @Eric24 machine.sleep() does nothing. Here is the code:

    STATIC mp_obj_t machine_sleep (void) {
        // TODO
        return mp_const_none;

  • @livius Thanks, but I actually mean machine.sleep(). Maybe it does nothing, but it is a valid function on the machine object, per help(machine).

  • @Eric24
    do you mean
    machine.deepsleep ?

    from docs -

    Gates the clock to the CPU, useful to reduce power consumption at any time during short or long periods. Peripherals continue working and execution resumes as soon as any interrupt is triggered (on many ports this includes system timer interrupt occurring at regular intervals on the order of millisecond).

    Stops the CPU and all peripherals (including networking interfaces, if any). Execution is resumed from the main script, just as with a reset. If a value in milliseconds is given then the device will wake up after that period of time, otherwise it will remain in deep sleep until the reset button is pressed

    as described above idle only reduce power consumption
    but deepsleep "restart" the board - near the same as pressing reset button

Log in to reply

Looks like your connection to Pycom Forum was lost, please wait while we try to reconnect.