28-05-2019, 17:59
Jak chcesz użyć biblioteki to po prostu ją czytasz i analizujesz. Czasami jest dużo przykładów i wyjaśnień, ale że ta biblioteka jest banalna, to i wiele nie ma.
Wszystko dostałeś w jednej zmiennej Button, to ją drukujesz w funkcji callback:
Jeśli biblioteka nie działałby prawidłowo wystarczyłoby zmienić progi podanych w niej wartości ADC, ewentualnie dodać/odjąć wartości i dopasować tablice do innej ilości przycisków.
W przykładowym callback'u drukujesz zmienną Button, co za problem przypisać tą zmienną do swojej zmiennej uint8_t "WcisnietyPrzycisk=Button", zamiast drukować Button.
Wszystko dostałeś w jednej zmiennej Button, to ją drukujesz w funkcji callback:
Kod:
// Callback function
void ButtonPush(byte Button) {
Serial.print("Button Pushed: ");
Serial.println(Button);
/* Will return 255 on release of a button
Or 0 to 4 corrisponding to a specific button
Depending on the resistors used to make your
keypad you may need to adjust the analog value
for each button, to do this you can change
Buttons.adc_key_val[0-4] to a slightly higher number
then the highest number you get on a direct analog read.
If you need more or less then 5 buttons, you can
adjust the values accordingly in the library files.
Library works out of the box for Cytron LCD and
Keypad shield, and should work for SainsSmart one as well.
*/
}
W przykładowym callback'u drukujesz zmienną Button, co za problem przypisać tą zmienną do swojej zmiennej uint8_t "WcisnietyPrzycisk=Button", zamiast drukować Button.
Miło być decenianym https://buycoffee.to/kaczakat