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.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]