Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

2 месяцев назад
2 месяцев назад
2 месяцев назад
2 месяцев назад
2 месяцев назад
8 месяцев назад
2 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
9 месяцев назад
8 месяцев назад
8 месяцев назад
9 месяцев назад
8 месяцев назад
10 месяцев назад
8 месяцев назад
2 месяцев назад
8 месяцев назад
8 месяцев назад
8 месяцев назад
10 месяцев назад
8 месяцев назад
8 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # WiringPi Library
  2. Welcome to the WiringPi Library, the highly performant GPIO access library for Raspberry Pi boards. This library is written in C and is designed to provide fast and efficient control of the GPIO pins by directly accessing the hardware registers using DMA.
  3. **Key Features:**
  4. - **Support:** WiringPi supports all Raspberry Pi Boards including Pi 5 ( :construction: On the Pi 5, only the GCLK functionality is currently not supported due to missing documentation of the RP1 chip).
  5. - **High Performance:** By directly accessing the hardware registers, WiringPi ensures minimal latency and maximum performance for your GPIO operations.
  6. - **Wide Adoption:** WiringPi is widely used in numerous projects, making it a reliable choice for your Raspberry Pi GPIO needs.
  7. Whether you’re working on a simple LED blink project or a complex automation system, WiringPi provides the tools you need to get the job done efficiently.
  8. ## How to use
  9. To compile programs with wiringPi Library, you need to include `wiringPi.h` as well as link against `wiringPi`:
  10. ```c
  11. #include <wiringPi.h> // Include WiringPi library!
  12. int main(void)
  13. {
  14. // uses BCM numbering of the GPIOs and directly accesses the GPIO registers.
  15. wiringPiSetupGpio();
  16. // pin mode ..(INPUT, OUTPUT, PWM_OUTPUT, GPIO_CLOCK)
  17. // set pin 17 to input
  18. pinMode(17, INPUT);
  19. // pull up/down mode (PUD_OFF, PUD_UP, PUD_DOWN) => down
  20. pullUpDnControl(17, PUD_DOWN);
  21. // get state of pin 17
  22. int value = digitalRead(17);
  23. if (HIGH == value)
  24. {
  25. // your code
  26. }
  27. }
  28. ```
  29. To compile this code, link against wiringPi:
  30. ```sh
  31. gcc -o myapp myapp.c -l wiringPi
  32. ```
  33. Be sure to check out the [examples](./examples/), build them using Make:
  34. ```sh
  35. cd examples
  36. make <example-name | really-all>
  37. ```
  38. The tool `gpio` can be used to set single pins as well as get the state of everything at once:
  39. ```
  40. pi@wiringdemo:~ $ gpio readall
  41. +-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+
  42. | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
  43. +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
  44. | | | 3.3v | | | 1 || 2 | | | 5v | | |
  45. | 2 | 8 | SDA.1 | IN | 1 | 3 || 4 | | | 5v | | |
  46. | 3 | 9 | SCL.1 | IN | 1 | 5 || 6 | | | 0v | | |
  47. | 4 | 7 | GPIO. 7 | IN | 0 | 7 || 8 | 0 | IN | TxD | 15 | 14 |
  48. | | | 0v | | | 9 || 10 | 1 | IN | RxD | 16 | 15 |
  49. | 17 | 0 | GPIO. 0 | IN | 1 | 11 || 12 | 1 | IN | GPIO. 1 | 1 | 18 |
  50. | 27 | 2 | GPIO. 2 | IN | 1 | 13 || 14 | | | 0v | | |
  51. | 22 | 3 | GPIO. 3 | IN | 1 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
  52. | | | 3.3v | | | 17 || 18 | 1 | IN | GPIO. 5 | 5 | 24 |
  53. | 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
  54. | 9 | 13 | MISO | IN | 0 | 21 || 22 | 1 | IN | GPIO. 6 | 6 | 25 |
  55. | 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
  56. | | | 0v | | | 25 || 26 | 0 | IN | CE1 | 11 | 7 |
  57. | 0 | 30 | SDA.0 | IN | 1 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
  58. | 5 | 21 | GPIO.21 | IN | 0 | 29 || 30 | | | 0v | | |
  59. | 6 | 22 | GPIO.22 | IN | 0 | 31 || 32 | 1 | IN | GPIO.26 | 26 | 12 |
  60. | 13 | 23 | GPIO.23 | IN | 1 | 33 || 34 | | | 0v | | |
  61. | 19 | 24 | GPIO.24 | IN | 1 | 35 || 36 | 1 | IN | GPIO.27 | 27 | 16 |
  62. | 26 | 25 | GPIO.25 | IN | 1 | 37 || 38 | 1 | IN | GPIO.28 | 28 | 20 |
  63. | | | 0v | | | 39 || 40 | 1 | IN | GPIO.29 | 29 | 21 |
  64. +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
  65. | BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
  66. +-----+-----+---------+------+---+---Pi 3B--+---+------+---------+-----+-----+
  67. ```
  68. ## Installing
  69. You can either build it yourself or use the prebuilt binaries:
  70. ### From Source
  71. 1. create debian-package
  72. ```sh
  73. # fetch the source
  74. sudo apt install git
  75. git clone https://github.com/WiringPi/WiringPi.git
  76. cd WiringPi
  77. # build the package
  78. ./build debian
  79. mv debian-template/wiringpi-3.0-1.deb .
  80. # install it
  81. sudo apt install ./wiringpi-3.0-1.deb
  82. ```
  83. ### Prebuilt Binaries
  84. Grab the latest release from [here](https://github.com/WiringPi/WiringPi/releases).
  85. Unzip/use the portable prebuilt verison:
  86. ```sh
  87. # unzip the archive
  88. tar -xfv wiringpi_3.0.tar.gz
  89. ```
  90. Install the debian package:
  91. ```sh
  92. # install a dpkg
  93. sudo apt install ./wiringpi-3.0-1.deb
  94. ```
  95. ## Ports
  96. wiringPi has been wrapped for multiple languages:
  97. * Node - https://github.com/WiringPi/WiringPi-Node
  98. * Perl - https://github.com/WiringPi/WiringPi-Perl
  99. * PHP - https://github.com/WiringPi/WiringPi-PHP
  100. * Python - https://github.com/WiringPi/WiringPi-Python
  101. * Ruby - https://github.com/WiringPi/WiringPi-Ruby
  102. ## Support
  103. Please use the [issue system](https://github.com/WiringPi/WiringPi/issues) of GitHub.
  104. If you're not sure whether to create an issue or not, please engage in [discussions](https://github.com/WiringPi/WiringPi/discussions)!
  105. Please do not email Gordon or @Gadgetoid.
  106. Please don't email GC2 for reporting issues, you might [contact us](mailto:wiringpi@gc2.at) for anything that's not meant for the public.
  107. ## History
  108. This repository is the continuation of 'Gordon's wiringPi 2.5' which has been [deprecated](https://web.archive.org/web/20220405225008/http://wiringpi.com/wiringpi-deprecated/), a while ago.
  109. * The last "old wiringPi" source of Gordon's release can be found at the
  110. [`final_source_2.50`](https://github.com/WiringPi/WiringPi/tree/final_official_2.50) tag.
  111. * The default `master` branch contains code that has been written since version 2.5
  112. to provide support for newer hardware as well as new features.
  113. :information_source:️ Since 2024, [GC2](https://github.com/GrazerComputerClub) has taken over maintenance of the project, supporting new OS versions as well as current hardware generations. We are dedicated to keeping the arguably best-performing GPIO Library for Raspberry Pi running smoothly. We strive to do our best, but please note that this is a community effort, and we cannot provide any guarantees or take responsibility for implementing specific features you may need.
  114. ## Debug
  115. WIRINGPI_DEBUG=1 ./my_wiringpi_program
  116. WIRINGPI_DEBUG=1 gpio readall