Advertisement
Guest User

VoIP PTT

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