Benutzer:DelphiN/FusstasterBuchscanner: Unterschied zwischen den Versionen

Aus FürthWiki
Markierung: Manuelle Zurücksetzung
 
(Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt)
Zeile 7: Zeile 7:
* [https://www.ebay.de/itm/351808743717 Fußpedal (Importeur: A.T.Shop s.r.o Borska 2803/75 CZ-31600 Pilsen)]
* [https://www.ebay.de/itm/351808743717 Fußpedal (Importeur: A.T.Shop s.r.o Borska 2803/75 CZ-31600 Pilsen)]
* Beliebiges USB-C zu USB-A Kabel (2m)
* Beliebiges USB-C zu USB-A Kabel (2m)
== Schaltplan ==
[[Datei:Fusstaster 00.png|600px]]


== Programm ==
== Programm ==
https://gist.github.com/mojoaxel/bfb0a610ac28fcd0799dca0c2d44816d
<pre>
<pre>
/*  
/*  

Aktuelle Version vom 29. Dezember 2025, 16:29 Uhr

Bauanleitung eines Fuß-Tasters zur Verwendung beim Buchscannen. Der Taster wird per USB mit dem PC verbunden, wird dort als Tastatur erkannt. Der Taster sendet bei jeder Betätigung jedes mal (einmalig) ein "Space" Zeichen (Leertaste).

Bauteil-Liste

Schaltplan

Fusstaster 00.png

Programm

https://gist.github.com/mojoaxel/bfb0a610ac28fcd0799dca0c2d44816d

/* 
 * For the Arduino Leonardo and Micro.
 * Sends a space character when a button is pressed.
 * 
 * This based on an official example code is in the public domain.
 * https://docs.arduino.cc/built-in-examples/usb/KeyboardMessage/
 */
#include "Keyboard.h"

const int buttonPin = 4;         // input pin for pushbutton
int previousButtonState = HIGH;  // for checking the state of a pushButton
int counter = 0;                 // button push counter

void setup() {
  // make the pushButton pin an input:
  pinMode(buttonPin, INPUT);
  // initialize control over the keyboard:
  Keyboard.begin();
}

void loop() {
  int buttonState = digitalRead(buttonPin);
  if ((buttonState == HIGH) && (buttonState != previousButtonState)) {
    // send a "space" character (once)
    Keyboard.print(" ");
    
    // only send a character every 0.5s (max speed)
    delay(500);
  }
  previousButtonState = buttonState;
}

Bilder