Keyhole
A lightweight library for serial-port interaction: send commands and get/set sketch variables via a JSON- and Python-compatible text interface.
Установка
Последняя опубликованная версия- Скачайте архив — реестр отдает его уже проверенным.
- В Arduino IDE выберите «Скетч → Подключить библиотеку → Добавить .ZIP библиотеку».
- Укажите скачанный файл — библиотека появится в списке доступных.
SHA-256:7bc5b3575991076bd7b6b408509f191e66aa846e58c8043971828d9e0aca13adKeyhole-1.15.0-7bc5b357.zipОписание
In one line, and usually with less than a microsecond of overhead, keyhole.variable("foo", foo); provides serial-port access to an integer, floating-point or String variable in your sketch. Set its value by sending foo=123\n - the variable() method will return true to let the sketch know when you do this. Query it by sending foo\n . Query all exposed variables at once by sending ?\n , or choose to have them auto-report themselves periodically. Responses are in easy-to-parse JSON format and can be turned into Python dicts with one call to ast.literal_eval(), but there's a plotter-compatibility mode too. For the computer's side of the interaction, a complementary Python module is included in the project repository (or available separately from PyPI with python -m pip install keyhole-comm[serial] ).