Random failure to upload code.

I do have a mkII for in circuit programming, although I had hoped that using arduino would mean I could leave it collecting dust :wink: And thanks for the advice about not doing 100 before I do a working prototype, I will definitely do that. It's good to know that I can at least change the time the bootloader waits for powerup. I am not entirely clear on how the bootloader can change the timing for reset, but I assume it's just outputting 5V through a resistor into a capacitor connected to reset?

Actually (sorry, I'm new to the arduino platform), there appears to be an option for using the arduino "as an ISP". Does that mean I can burn a bootloader by using the existing bootloader? Huh? If that was the case, I'd be pretty excited, because then at least it's just a two-step programming operation that I could script to happen from a single command without having to do multiple wiring jobs.

Thanks for that debug info Coding Badly. It outputs a lot of stuff, but it scrolls by quickly and the buffer isn't long enough to see the beginning by the end... do you know if I can make it send the debug output to a file? In any case, I captured it in the terminal and this is what it said:

avrdude: Version 5.10, compiled on Mar 23 2010 at 15:05:31
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/neltnerb/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/ttyUSB0
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53

...

         Programmer Type : Arduino
         Description     : Arduino
avrdude: Send: A [41] . [80]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [02] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [01] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [98]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [03] 
avrdude: Recv: . [10] 
         Hardware Version: 2
         Firmware Version: 1.16
avrdude: Send: A [41] . [84]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [85]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [86]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [87]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [89]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: Send: A [41] . [81]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [01] 
avrdude: Recv: . [10] 
avrdude: Send: A [41] . [82]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Recv: . [10] 
avrdude: Send: B [42] . [86] . [00] . [00] . [01] . [01] . [01] . [01] . [03] . [ff] . [ff] . [ff] . [ff] . [00] . [80] . [04] . [00] . [00] . [00] . [80] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: E [45] . [05] . [04] . [d7] . [c2] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: P [50]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: AVR device initialized and ready to accept instructions

Reading | avrdude: Send: u [75]   [20] 
avrdude: Recv: . [14] . [1e] . [95] . [0f] . [10] 
################################################## | 100% 0.01s

avrdude: Device signature = 0x1e950f
avrdude: Send: V [56] . [a0] . [03] . [fc] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] . [a0] . [03] . [fd] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] . [a0] . [03] . [fe] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: Send: V [56] . [a0] . [03] . [ff] . [00]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [00] 
avrdude: Recv: . [10] 
avrdude: reading input file "/tmp/build1252157735055366361.tmp/LightBrick.cpp.hex"
avrdude: writing flash (17602 bytes):

followed by many lines of output of bytes being sent to the arduino's flash memory, with intermittent receives, and ending with something like this:

avrdude: Send: t [74] . [00] . [80] F [46]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [80] . [93] ? [3f] . [05] . [0e] . [94] . [be] . [18] q [71] . [c6] / [2f] p [70] # [23] 0 [30] . [09] . [f0] . [a2] . [c7] . [88] . [e0] . [80] . [93] ? [3f] . [05] . [0e] . [94] . [be] . [18] & [26] . [c6] . [85] 0 [30] . [19] . [f5] . [e0] . [91] @ [40] . [05] . [f0] . [91] A [41] . [05] . [84] . [81] . [95] . [81] . [89] + [2b] . [09] . [f4] . [91] . [c7] . [10] . [92] E [45] . [05] . [10] . [92] D [44] . [05] . [c9] . [01] . [0c] . [97] . [90] . [93] C [43] . [05] . [80] . [93] B [42] . [05] . [90] . [93] : [3a] . [05] . [80] . [93] 9 [39] . [05] . [10] . [92] 8 [38] . [07] . [10] . [92] 7 [37] . [07] . [10] . [92] 8 [38] . [05] . [10] . [92] 7 [37] . [05] . [88] . [e0] . [80] . [93] ? [3f] . [05] . [aa] . [c1] . [80] . [91] k [6b] . [05] . [90] . [91] l [6c] . [05] . [01] . [96] . [90] . [93] l [6c] . [05] . [80] . [93] k [6b] . [05] . [e9] . [01] . [a8] . [97] . [80] . [91] 
avrdude: Recv: . [10] 
avrdude: Send: U [55] @ [40] . [09]   [20] 
avrdude: Recv: . [14] 
avrdude: Recv: . [10] 
avrdude: Send: t [74] . [00] . [80] F [46]   [20] 
avrdude: Recv: . [14] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

the timing of which correlates with my "on" LED turning back on.

Does this sound like the "resetting too soon" issue Grumpy_Mike suggested to everyone else as well?