[ArduinoBT] burn bootloader

Hello !

I have done something excessively stupid ... I uploaded a program continuously sending data over the bluetooth link. Furthermore the code cannot be more simple (and stupid)

/*
 * Simon Ruffieux
 * Project Arduino Bluetooth Switch
 * Aout 2009
 * EIA-FR
 */

#include <EEPROM.h>
#include <stdlib.h>
#include <string.h>
#include <avr/sleep.h>

#define LED_PIN 13
#define WAKE_PIN 2
#define RESET 7

//char* type[]={"Undefined","Lamp", "Ceiling Lamp", "Radio", "Charger", "Television", "Ventilator", "Other"};


void setup(){
  pinMode(LED_PIN,OUTPUT);
  pinMode(WAKE_PIN, INPUT);
  Serial.begin(115200);
  
  /*
  // Reset the bluetooth interface
  digitalWrite(RESET, HIGH);
  delay(10);
  digitalWrite(RESET, LOW);
  delay(2000);
  //configure the bluetooth module
  Serial.println(SET BT PAGEMODE 3 2000 1);
  Serial.println(SET BT NAME BTSWITCH);
  Serial.println(SET BT ROLE 0 f 7d00);
  Serial.println(SET CONTROL ECHO 0);
  Serial.println(SET BT AUTH * 12345);
  Serial.println(SET CONTROL ESCAPE - 00 1);
  */
}


static int ledState = 0;
char buffer[50];
char c;
int waitTime;
  
void loop(){
     
  // If there is something to read in the serial
  if(Serial.available()){
      c = Serial.read();
         
  }
  Serial.print(c);
  
  if(ledState){
      digitalWrite(LED_PIN,HIGH);
    }
    else{
      digitalWrite(LED_PIN,LOW);
    } 
}

the Serial.print(c); is the problem ... yeah I know ... I am stupid !

So now I cannot upload anything anymore to the card through Bluetooth. Because the bluetooth link is continuously busy ...

So I think the only solution is to upload a new program through a cable connection, is that right ?

So I should buy a AVRISP mkII cable and then burn a new hexfile through the Arduino IDE.

Am I right ?

Is there a cheaper solution (cable that would be cheaper than the mkII ?)

(And yeah I know that was a stupid mistake ..)

Thbaks

Hi nomis,

your sketch should not cause any problem! Its really not that easy to crash your Arduino :slight_smile:

To upload a new sketch, you have to press and release the reset button at the right time (see http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1247005623/3#1).

When the Arduino is reset, it run the bootloader instead of your code.

MikeT

Hello !

Just to keep you informed ...
It was most likely impossible to upload the sketch through Bluetooth. I tried many times with the best timing as possible .. but was not working

So I plugged the AVRISP cable, and simply programmed the bootloader hex and now it is working like a charm again !