clone of Digispark Pro

colorUSBBoardProccessorProgMemMIPSSPII2CUARTidle PWR
blackMicroDigispark Pro(Default - 16Mhz)ATTINY16716KB0.5KB162110.109W

Aliexpress: ~3$


http://digistump.com/products/110

http://digistump.com/wiki/digispark/tutorials/connectingpro

src: http://digispark.s3.amazonaws.com/DigisparkProDiagram2.png


Blink Example

Power consumption: 0.108-0.120W

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(1, OUTPUT); //on board LED 
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(1, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(1, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}


Low Power Blink Example

Power Consumption: 0.038-0.051W

#include <avr/wdt.h>
#include <avr/sleep.h>
#include <avr/interrupt.h>
 
#define adc_disable() (ADCSRA &= ~(1<<ADEN)) // disable ADC (before power-off)
#define adc_enable()  (ADCSRA |=  (1<<ADEN)) // re-enable ADC
 
void setup()
{
  // Power Saving setup
  for (byte i = 0; i < 6; i++) {
    pinMode(i, INPUT);      // Set all ports as INPUT to save energy
    digitalWrite (i, LOW);  //
  }
  adc_disable();          // Disable Analog-to-Digital Converter
 
  wdt_reset();            // Watchdog reset
  wdt_enable(WDTO_1S);    // Watchdog enable Options: 15MS, 30MS, 60MS, 120MS, 250MS, 500MS, 1S, 2S, 4S, 8S
  WDTCR |= _BV(WDIE);     // Interrupts watchdog enable
  sei();                  // enable interrupts
  set_sleep_mode(SLEEP_MODE_PWR_DOWN); // Sleep Mode: max
}
 
void loop()
{
  pinMode(1, OUTPUT); 
  digitalWrite(1, HIGH);
 
  sleep_enable();
  sleep_cpu();
   
  //Set the LED pins to LOW. This turns it off
  pinMode(1, OUTPUT); 
  digitalWrite(1, LOW);
 
  sleep_enable();
  sleep_cpu();     
}
 
ISR (WDT_vect) {
  WDTCR |= _BV(WDIE);
}



  • No labels