MIPS and MCU on/off
This sketch uses the Energy Saving library for MIPS and MCU power management.
In particular in this example is shown how the MIPS and the MCU can be managed via an external interrupt.
- Arduino Tian
- One switch button or a jumper
Use a switch button or a simple jumper and connect it to pin 8 of the board.
Plug the board to the computer and upload the code.
The board must be powered with one power supply that provides output at least 2A.
You may need to use a Y-Cable (USB Micro-B to Standard Male A).
This sketch allows the users to manage the Tian and MCU power management.
Users can power up or power down MIPS and MCU with an external interrupt.
#define MIPS_PIN 32 //PA28 PIN 32
nrgSave.begin(WAKE_EXT_INTERRUPT, 8, wakeUp); //standby setup for external interrupts
doSomething();// call the "doSomething" function
sleep();// call the "sleep" function
//blink for 90 seconds
for(int i=0; i<90; i++)
// MCU and MIPS go in standy mode
nrgSave.standby(); //now mcu goes in standby mode
void wakeUp(void) //interrupt routine (isn't necessary to execute any tasks in this routine
//mcu is waked-up by the interrupt
//wake up mips
After that you have uploaded the sketch, the Led 13 will blink for 90 seconds.
After 90 seconds the MIPS and the MCU will go OFF.
If you want wake up the MCU, then connect a jumper or a switch button between the 8 pin and GND, as shown in the below image.