0

I made a simple test sketch to make my ATTiny85 emulate a Keyboard and send a sequence of keystrokes.

#include "DigiKeyboard.h"
void setup() {
  // don't need to set anything up to use DigiKeyboard
}

void loop() {
  DigiKeyboard.delay(1000);
  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.sendKeyStroke(106); // F15
  DigiKeyboard.delay(59 * 1000);
}

It worked fine, but now every time I plug it to the USB port on my computer, Windows detects it as a Keyboard and starts typing what I programmed it to type.

Arduino IDE can't reprogram it. When it says "Plug in device now", I do it, but it immediately acts like a Keyboard, not like a programmable ATTiny85.

Arduino IDE

Note: Image shows the console output. Code is just a simple blinker.

Is there any way to save this board? I just want to upload another sketch to it. Maybe some way to rewrite the bootloader or to erase the flash memory entirely.

Also, please give me some advice so I can avoid being locked out again in the future. I really want to use this board as a Keyboard emulator, but I want to be able to reprogram it if necessary.

ATTiny85

10
  • 1
    Please don't post images of code. Just copy and post your code into the editor, and then format it as a code sample. Aug 22, 2022 at 23:24
  • @sempaiscuba the code is not the important part of the image... The console output is. Aug 22, 2022 at 23:42
  • 1
    add the console output as text, not a picture
    – jsotola
    Aug 22, 2022 at 23:52
  • use a switch or a jumper to enable the keyboard code
    – jsotola
    Aug 22, 2022 at 23:53
  • You have nothing connected to the board at all except the computer?
    – timemage
    Aug 23, 2022 at 0:25

1 Answer 1

2

If you can't access the bootloader using USB your remaining option is ISP/ICSP (In-Circuit Serial Programming). I have that digispark board and I have never been able to program it using Arduino's IDE/USB. However, since then I always use both an USBasp programmer and the AVRDUDESS programming tool. With them you can eassily program the controller (they have never failed me). Connect the SPI, +5V, GND and RESET connectors from the ATTINY85 to the programmer, compile the code, program the binaries with AVRDUDESS and voila.

3
  • Hello. Could you please add more details to this answer? What is USBasp? AVRDUDESS? Which "programmer" are you talking about? Is it a separated device? Mar 28, 2023 at 23:49
  • I added some details to my response. Yes, USBasp is a separate device, a programmer typically implemented with an Atmel AVR controller. You can easily buy them from Ebay or someplace else. AVRDUDESS is a GUI tool to help you flash the compiled binary into the target controller, i.e., the attiny85 in this case.
    – jcfgonc
    Mar 29, 2023 at 14:30
  • You can learn a lot from Have I bricked my Arduino Uno? Problems with uploading to board
    – sa_leinad
    Apr 28, 2023 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.