Can't upload over old sketch...

I had a LCD demo sketch working last night, then tried to upload a new OneWire sketch today. I get -lots- of errors on uploading... but mostly related to LCD, which I am NOT using in the new sketch. When I look at Serial Monitor, it's still transmitting the text of last night's demo.

Seems I can't upload a new sketch because this thing won't shut up long enough to allow it.

Is there a Hard Reset or Clear that I'm just not aware of?

Many thanks.

Try uploading the Blink sketch to it an see what happens.

It resets the board so you're program shouldn't interfere with programming. You can always remove what's on pins D1 & D2 to make sure if it's a concern.

If blink won't upload, and it still has your last sketch, you need to reflash the entire chip, bootloader and all.

I've done this for a number of people now, and so far it at least fixes the issue.

I use Adafruit's UsbTinyISP and highly recommend getting one for such cases.

When I looked into the actual issue, something seems to corrupt the eeeprom area and locks out the lock bits. Not sure why reflashing it works, also curiously once reflashed doesn't seem to happen again.

Blink is happily Blinking along... but when I swtich again to the new sketch, I get tons of SerLCD-related errors, the Title area of the bottom window is 'Error building library "LCD"'.

Then, here is the beginning of the errors (note that I am not doing anything with LCDs in this, but did in the earlier sketch). This goes on and on and on...

serlcd-v2.c:75:73: error: d:\Pics\c\16F688.h: Permission denied
serlcd-v2.c:76:32: error: d:\Pics\c\int16CXX.H: Permission denied
serlcd-v2.c:78: warning: ignoring #pragma config 
serlcd-v2.c:134: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'letter'
serlcd-v2.c:135: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'cursor_position'
serlcd-v2.c:136: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'splash_enable'
serlcd-v2.c:138: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'backlight_counter'
serlcd-v2.c:139: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'brightness_setting'
serlcd-v2.c:140: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'Backlight_Setting'
serlcd-v2.c:142: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'LCD_Type'

And here's the sketch I'm trying to upload:

#include <OneWire.h>

OneWire ds(10);  // on pin 10

void setup(void) {
  // initialize inputs/outputs
  // start serial port
  Serial.begin(9600);
}

void loop(void) {
  byte i;
  byte present = 0;
  byte data[12];
  byte addr[8];
  int HighByte, LowByte, TReading, SignBit, Tc_100, Whole, Fract;
  
  if ( !ds.search(addr)) {
      Serial.print("No more addresses.\n");
      ds.reset_search();
      return;
  }
  
  Serial.print("R=");
  for( i = 0; i < 8; i++) {
    Serial.print(addr[i], HEX);
    Serial.print(" ");
  }

  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.print("CRC is not valid!\n");
      return;
  }
  
  if ( addr[0] != 0x10) {
      Serial.print("Device is not a DS18S20 family device.\n");
      return;
  }

  ds.reset();
  ds.select(addr);
  ds.write(0x44,1);         // start conversion, with parasite power on at the end
  
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.
  
  present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE);         // Read Scratchpad

  Serial.print("P=");
  Serial.print(present,HEX);
  Serial.print(" ");
  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
    Serial.print(data[i], HEX);
    Serial.print(" ");
  }
  Serial.print(" CRC=");
  Serial.print( OneWire::crc8( data, 8), HEX);
  Serial.println();
  LowByte = data[0];
  HighByte = data[1];
  TReading = (HighByte << 8) + LowByte;
  SignBit = TReading & 0x8000;  // test most sig bit
  if (SignBit) // negative
  {
    TReading = (TReading ^ 0xffff) + 1; // 2's comp
  }
  Tc_100 = (6 * TReading) + TReading / 4;    // multiply by (100 * 0.0625) or 6.25

  Whole = Tc_100 / 100;  // separate off the whole and fractional portions
  Fract = Tc_100 % 100;

  if (SignBit) // If its negative
  {
     Serial.print("-");
  }
  Serial.print(Whole);
  Serial.print(".");
  if (Fract < 10)
  {
     Serial.print("0");
  }
  Serial.print(Fract);
  Serial.print("\n");
}

On a curious whim, I renamed the Libraries/LCD folder to "LCDerrrr" and my error changed to match. I then renamed back, but removed it from the Libraries folder. I can now compile.

Weird.

Yeah I just tried with Arduino 0016, and THIS library and it compiled sans issues.

Weirdness.

I blame sunspots.

Not weird... just a PC with a confused PATH about where to get files from.

Clearly you don't want to include your MICROCHIP PIC libraries when working with Atmel AVR's. Many of us have multiple C's installed for various reasons... it bound to happen... but it's like marrying your cousin... it'll never work...

serlcd-v2.c:75:73: error: d:\Pics\c\16F688.h: Permission denied
serlcd-v2.c:76:32: error: d:\Pics\c\int16CXX.H: Permission denied

Just a simple "OOPS". You should not have to rename things... just check you PATH ENVIRONMENT. Your PIC programming environment is getting preference over your arduino environment... you should be able to fix that with a little shuffling.