keybrd library is an open source library for creating custom-keyboard firmware.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

tutorial_6_active_high.md 3.0KB

7 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. Tutorial 6 - Active high
  2. ========================
  3. Pull-up resistors
  4. -----------------
  5. There are many sources that explain "pull-up resistors", so I won't repeat it here.
  6. Here is a [good tutorial on Pull-up Resistors](https://learn.sparkfun.com/tutorials/pull-up-resistors/what-is-a-pull-up-resistor).
  7. Active low
  8. ----------
  9. Most the keyboards up to this point in the tutorial series have used active low with internal pull-up resistors.
  10. "Active low" means that if a switch is pressed (active state), the read pin is low.
  11. When the switch is released (inactive state), the pull-up resistor pulls the read pin high.
  12. Arduino boards have internal pull-up resistors, which saves on parts and labor compared to manually adding external pull resistors.
  13. To make a key matrix active low:
  14. * Orient diodes with cathode (banded end) towards the strobe pins (row)
  15. * Instantiate the scanner in the sketch with strobeOn LOW, like this:
  16. ```
  17. Scanner_uC scanner(LOW, readPins, readPinCount);
  18. ```
  19. Active high
  20. -----------
  21. "Active high" means that if a switch is pressed (active), the read pin is high.
  22. When the switch is released (inactive), the pull-down resistor pulls the read pin low.
  23. Arduino boards do not have internal pull-down resistors.
  24. If you want to use active low, you will have to add external pull-down resistors to the read pins.
  25. To make a key matrix active high:
  26. * Add an external 10k Ohm pull-down resistor to each read pin
  27. * Orient diodes with cathode (banded end) towards the read pins
  28. * Instantiate the scanner in the sketch with strobeOn HIGH, like this:
  29. ```
  30. Scanner_uC scanner(HIGH, readPins, readPinCount);
  31. ```
  32. Making a breadboard keyboard active-high
  33. ----------------------------------------
  34. Make the following changes to the basic breadboard keyboard described in [tutorial_1_breadboard_keyboard.md](tutorial_1_breadboard_keyboard.md):
  35. * Add an external 10k Ohm pull-down resistor (red bus) to each read pin
  36. * Orient diodes with cathode (banded end) towards the read pins
  37. ![pull-down resistors](keybrd_6_active_high/back.JPG "pull-down resistors")
  38. keybrd sketch with active-high
  39. ------------------------------
  40. The [keybrd_6_active_high.ino](keybrd_6_active_high/keybrd_6_active_high.ino) sketch will run on the above breadboard keyboard.
  41. <br>
  42. <a rel="license" href="https://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by/4.0/88x31.png" /></a><br /><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">keybrd tutorial</span> by <a xmlns:cc="https://creativecommons.org/ns" href="https://github.com/wolfv6/keybrd" property="cc:attributionName" rel="cc:attributionURL">Wolfram Volpi</a> is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.<br />Permissions beyond the scope of this license may be available at <a xmlns:cc="https://creativecommons.org/ns" href="https://github.com/wolfv6/keybrd/issues/new" rel="cc:morePermissions">https://github.com/wolfv6/keybrd/issues/new</a>.