Misc files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ROT-xiao.ino 678B

12345678910111213141516171819202122232425262728293031
  1. #include <CommonBusEncoders.h>
  2. #include <HID-Project.h>
  3. CommonBusEncoders encoders(8, 10, 3, 1);
  4. void setup() {
  5. //Setup encoder
  6. encoders.setDebounce(16);
  7. encoders.resetChronoAfter(10000);
  8. encoders.addEncoder(1, 2, 9, 1, 100, 199);
  9. pinMode(5, OUTPUT);
  10. digitalWrite(5, LOW);
  11. //Start Consumer keyboard
  12. Consumer.begin();
  13. //Serial debugging
  14. //Serial.begin(9600);
  15. }
  16. void loop() {
  17. int code = encoders.readAll();
  18. if (code != 0) {
  19. //Serial.println(code);
  20. }
  21. if (code == 101) Consumer.write(MEDIA_VOLUME_DOWN);
  22. if (code == 100) Consumer.write(MEDIA_VOLUME_UP);
  23. if (code == 199) Consumer.write(MEDIA_VOLUME_MUTE);
  24. }