ATTiny85

Hi. I just bought an ATTiny85 for a very basic project. I want it to type something just as soon as it is plugged in (with no button push or anything). Here’s the code:

#include <Keyboard.h>

void setup() {
  // open the serial port:
  Serial.begin(9600);
  // initialize control over the keyboard:
  Keyboard.begin();
  delay(1000);
  Keyboard.println("Hello World");
}

void loop() {
}

The problem is that I haven’t been able to configure the IDE to work. When I compile the above code, I get the following error:

In file included from C:\Users\Miquel\Desktop\KeyboardSerial\KeyboardSerial.ino:1:0:
C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\Keyboard\src/Keyboard.h:25:17: fatal error: HID.h: No such file or directory
 #include "HID.h"
                 ^
compilation terminated.
exit status 1
Error compilando para la tarjeta Digispark (Default - 16.5mhz).

I’ve already selected board Digispark (Default - 16.5mhz)

Is the Keyboard library supported on the ATTiny85 ?
From Keyboard - Arduino Reference

The keyboard functions enable 32u4 or SAMD micro based boards to send keystrokes to an attached computer through their micro’s native USB port.

I want it to type something just as soon as it is plugged in

This sounds very much like you are making a USB "Rubber Ducky". Is that what you are doing and, if so, what is its purpose ?

I believe it's used for the same, but now that you mention it, I don't think it actually has a 32U4 chip, so maybe that's the issue. I'll try to do some research.
It's one of these: https://www.google.com/search?q=AZDelivery+Digispark+Rev.3+Kickstarter+ATTiny85&rlz=1C1CHBD_esES890ES890&sxsrf=ALeKk025mGlO3KZY2voGlXXb2sSP0IxUTg:1613125177107&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjnlqPJj-TuAhXATxUIHbZCBYsQ_AUoAnoECAgQBA&biw=1920&bih=937

I don't know what a Rubber Ducky is. Basically, I have a wireless keyboard that is not detected in my BitLocker screen, so I have to plug in another keyboard every time. I want this USB to automatically type in the password with a small usb device.

I don't know what a Rubber Ducky is

There is no hardware serial in an ATtiny.

UKHeliBob:
Rubber Ducky Attack - What does "Rubber Ducky Attack" mean? - Plurilock

I see. As you can see/imagine, my computer skills don't go as far as to be able to do that. As I said, my wireless keyboard is not detected until I type in my password in the BitLocker screen with a wired keyboard, which is a bulky and annoying solution.

Instead of typing your bitlocker password you want the ATtiny to send it, huh? If so, why would you bother with encryption and passwords at all?

Danois90:
Instead of typing your bitlocker password you want the ATtiny to send it, huh? If so, why would you bother with encryption and passwords at all?

Because it’s my work laptop. I can’t choose to disable it.

You need a DFROBOT Beetle, it’s programmed the same as a Leonardo (which can do keyboard.h)

PE - I don’t know if there’s anything that will plug into a PC’s USB_A without a micro/mini_B transition (cable).

It doesn't work with the BitLocker either, so yes, I'll probably have to go for a 32U4 version.

Did you get this to work? I have an Arduino Micro Pro which is caperble of USB communication via the Arduino cable. Problem is, it works once Windows has booted but not on the Bitlocker screen.

If the ATTiny85 Digispark works, please let me know!

I saw this online and I’m wondering how I can get this to work with my trinket 3.3v board? Basically I’m trying to
use this for my trinket 3.3v board. The sketch will not compile without errors.
int pin 0 input
int pin 1 led output blink light when pin 0 or 2 detect input
int pin 2 input
int pin 3 output with timer set to 4mhz
int pin 4 output with timer set to 8mhz

const int freqOutputPin = 9;   // OC1A output pin for ATmega32u4 (Arduino Micro)
const int ocr1aval  = 0;


void setup()
{
   pinMode(freqOutputPin, OUTPUT);
  
   TCCR1A = ( (1 << COM1A0));
  
   TCCR1B = ((1 << WGM12) | (1 << CS10));


   TIMSK1 = 0;
  
   OCR1A = ocr1aval;  


   pinMode(2, INPUT);


   pinMode(3, INPUT);  
}


void loop()
{


if (digitalRead(2) == HIGH){
OCR1A = 1;
}


else if (digitalRead(2) == HIGH){
OCR1A = 3;
}
  
}

Find a bug here:

if (digitalRead(2) == HIGH){ //Read 2
OCR1A = 1;
}
else if (digitalRead(2) == HIGH){ //Read 2 again?
OCR1A = 3;
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.