Push button once after delay no loop

I have a digispark attiny85 that I'm trying to have input a keystroke once when a computer is turned on and not loop. Is this something that is possible? All I've been able to find is starting the code with "void loop()" and setting a timer on it.

Is it possible to set another parameter to hit keystrokes once after a delay and it will do the same thing after a reboot or is looping keystrokes the only option?

Huh?

Hello

You can design and code a function to do this job.

What would I need to change in my code to only do it once and not on a loop?

void setup() {

}


void loop() {

  DigiKeyboard.sendKeyStroke(0);
  
  DigiKeyboard.sendKeyStroke(KEY_F2);
  
  DigiKeyboard.delay(60000);
}

try this

void setup() 
{
  DigiKeyboard.sendKeyStroke(0);
  DigiKeyboard.sendKeyStroke(KEY_F2);
//  DigiKeyboard.delay(60000);

}
void loop()
{
}
1 Like

This works, but the pc I'm using doesn't drop power to USB like some on reboot sadly.

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