SparkFun Forums 

Where electronics enthusiasts find answers.

For the discussion of Arduino related topics.
By Gulianrdgd
#198919
Hello i'm new here but i'll try to be very descriptive. My arduino pro micro keeps bricking after i upload my own code, it works with blink and other codes but a soon as i enter the following code it doesn't work anymore. what i mean by bricked is that it isn't recognized by my computer and that it can't be found as a COM. I can revive it by connecting the RST pin to groudn two times and then upload blink.
Code: Select all
#include <LowPower.h>

int vibr_pin=3;
int LED_Pin=6;


void setup() {
  Serial.begin(9600);
  pinMode(vibr_pin,INPUT);
  pinMode(LED_Pin,OUTPUT);
}

void loop()
{
  digitalWrite(LED_Pin,LOW);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
  LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

  int val;
  val=digitalRead(vibr_pin);
  if(val==0)
  {
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
    digitalWrite(LED_Pin,LOW);
   }
   else
   digitalWrite(LED_Pin,HIGH);
}
i think it has something to do with the include but i dont know.