Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Car remote sketch by Bigboy™
- Ten kod uzywa biblioteki HID od NicoHood
- Zobacz dokumentacje Projektu HID aby dowiedziec sie wiecej.
- https://github.com/NicoHood/HID/wiki/Consumer-API
- idealne wartosci przyciskow 0 = nic 255 = mode 392 = prev 551 = next 749 = vol+ 1023 = vol-
- rezystancje : pullup 1K, 3180R(1680+1500), 1680R(860+820), 860R(390+470), 390R, 0R
- Wszystkie funkcje https://github.com/NicoHood/HID/blob/master/src/HID-APIs/ConsumerAPI.h
- */
- #include "HID-Project.h"
- void setup() {
- Consumer.begin();
- }
- void loop() {
- delay(100); //szybkosc dzialania przyciskow
- int x;
- x = analogRead(A0); //A0 to pin odczytu wartosci
- if (x > 1000) { //wartosc 1023
- Consumer.write(MEDIA_VOL_DOWN); //przycisk vol-
- }
- else if ( (x >= 700) && (x <=800) ) { //wartosc 749
- Consumer.write(MEDIA_VOL_UP); //przycisk vol+
- }
- else if ( (x >= 500) && (x <=600) ) { //wartosc 551
- Consumer.write(MEDIA_NEXT); //przycisk next
- }
- else if ( (x >= 350) && (x <=450) ) { //wartosc 392
- Consumer.write(MEDIA_PREV); //przycisk prev
- }
- else if ( (x >= 200) && (x <=300) ) { //wartosc 255
- Consumer.write(MEDIA_PLAY_PAUSE); //przycisk mode
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement