diff options
| author | Ryan <fauxpark@gmail.com> | 2021-08-18 18:20:25 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-18 18:20:25 +1000 |
| commit | b16091659cc9a724a8800f77e631643b4ab089ad (patch) | |
| tree | e44933472c6d100bd4fc5d8a693d9d21e3c32f6f /lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz | |
| parent | cf5e40c25139ff64ff246f1c6280e983ef75551c (diff) | |
| download | qmk_firmware-b16091659cc9a724a8800f77e631643b4ab089ad.tar.gz qmk_firmware-b16091659cc9a724a8800f77e631643b4ab089ad.zip | |
Move USB Host Shield and Arduino core to `lib/` (#13973)
Diffstat (limited to 'lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz')
| -rw-r--r-- | lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino b/lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino new file mode 100644 index 000000000..6ee462c1e --- /dev/null +++ b/lib/usbhost/USB_Host_Shield_2.0/examples/PSBuzz/PSBuzz.ino | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | Example sketch for the Playstation Buzz library - developed by Kristian Lauszus | ||
| 3 | For more information visit my blog: http://blog.tkjelectronics.dk/ or | ||
| 4 | send me an e-mail: kristianl@tkjelectronics.com | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <PSBuzz.h> | ||
| 8 | |||
| 9 | // Satisfy the IDE, which needs to see the include statment in the ino too. | ||
| 10 | #ifdef dobogusinclude | ||
| 11 | #include <spi4teensy3.h> | ||
| 12 | #include <SPI.h> | ||
| 13 | #endif | ||
| 14 | |||
| 15 | USB Usb; | ||
| 16 | PSBuzz Buzz(&Usb); | ||
| 17 | |||
| 18 | void setup() { | ||
| 19 | Serial.begin(115200); | ||
| 20 | #if !defined(__MIPSEL__) | ||
| 21 | while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection | ||
| 22 | #endif | ||
| 23 | if (Usb.Init() == -1) { | ||
| 24 | Serial.print(F("\r\nOSC did not start")); | ||
| 25 | while (1); // Halt | ||
| 26 | } | ||
| 27 | Serial.println(F("\r\nPS Buzz Library Started")); | ||
| 28 | } | ||
| 29 | |||
| 30 | void loop() { | ||
| 31 | Usb.Task(); | ||
| 32 | |||
| 33 | if (Buzz.connected()) { | ||
| 34 | for (uint8_t i = 0; i < 4; i++) { | ||
| 35 | if (Buzz.getButtonClick(RED, i)) { | ||
| 36 | Buzz.setLedToggle(i); // Toggle the LED | ||
| 37 | Serial.println(F("RED")); | ||
| 38 | } | ||
| 39 | if (Buzz.getButtonClick(YELLOW, i)) | ||
| 40 | Serial.println(F("YELLOW")); | ||
| 41 | if (Buzz.getButtonClick(GREEN, i)) | ||
| 42 | Serial.println(F("GREEN")); | ||
| 43 | if (Buzz.getButtonClick(ORANGE, i)) | ||
| 44 | Serial.println(F("ORANGE")); | ||
| 45 | if (Buzz.getButtonClick(BLUE, i)) | ||
| 46 | Serial.println(F("BLUE")); | ||
| 47 | } | ||
| 48 | } | ||
| 49 | } | ||
