Skip to content

Instantly share code, notes, and snippets.

@Robotto
Created June 14, 2020 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Robotto/0136fcf4898b86083ae55bc6764ba429 to your computer and use it in GitHub Desktop.
Save Robotto/0136fcf4898b86083ae55bc6764ba429 to your computer and use it in GitHub Desktop.
quick and dirty button to trigger a random number generator for an exam type situation...
#include "Keyboard.h"
const int buttonPin = 10;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
if(digitalRead(buttonPin)==LOW)
{
delay(100); //debounce
Keyboard.println("python3 rando.py 4");
while(digitalRead(buttonPin)==LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment