Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Goblin Engineering VoIP PTT switch V1.0
- // Created 20 May 2014
- // by Mauricio Allayme AKA Vargtassen@Hellscream-EU
- // Author is not responsable for any violent explosions. USE AT OWN RISK!
- // Code is compatible only with ATmega32u4 based Arduinos such as the Leonardo or Micro.
- // Declaring digital pins for switch input and status LED. Pedal switch is connected between Arduino GND pin and pttPin.
- int pttPin = 7;
- int ledPin = 9;
- // Declaring what key to trigger PTT on VoIP application. Should be something you don´t have keybound.
- int keytoPress = '0';
- // Setting variables.
- void setup() {
- pinMode(pttPin, INPUT_PULLUP);
- pinMode(ledPin, OUTPUT);
- Keyboard.begin();
- // Delay to reprogram the Arduino in case of SNAFU.
- delay(5000);
- }
- // Loop checks if pttPin is pulled low, then holds the predefined key.
- void loop() {
- if (digitalRead(pttPin) == LOW) {
- Keyboard.press(keytoPress);
- digitalWrite(ledPin, HIGH);
- }
- // When pedal switch is released, pttPin is pulled high releasing the keypress.
- else {
- Keyboard.releaseAll();
- digitalWrite(ledPin, LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement