Go Down

Topic: having trouble loading sketch (Read 631 times) previous topic - next topic


having trouble loading sketch i keep getting this

avrdude: stk500v2_disable(); failed to leave programing mode

following projects out of the book getting started with arduino
first one i did loaded but now i am not sure if it loading them at all hears  the one i am doing right now.

i am also wondering i want to mount my board but i do not know how i should mount it to or how to space it and what to space it with.

ps. any help and or suggestion will be helpful. and think u in advance for your help.     

// turn on led when the button is pressed
// and keep it on  after it is released
// now with a new and improved formula!

const int LED = 13; // the pin for the LED
const int BUTTON = 7; // the input pin were the
// pushbutton is connected
int val = 0; // val will be used to store the state
// of the input pin
int old_val = 0; // this variable stores the previous
// value of "val"
int state = 0;  // LED off and 1 = LED on

void setup(){
  pinMode(LED, OUTPUT); // tell arduino LED is an input
  pinMode(BUTTON, INPUT); // and BUTTON is an input
void loop(){
  val = digitalRead(BUTTON); // read input value and store it

  // check if there was a transition
  if ((val == HIGH) && (old_val == LOW)){
    state = 1 - state;

  old_val = val; // val is now old, let's store it

  if (state ==1) {
    digitalWrite(LED, HIGH); // turn led on
    digitalWrite(LED, LOW);

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131