Собственно telepot
На кнопку бот должен отсылать команду /ring, но не отрабатывает условие.
Когда кнопка зажата GPIO.input(16) возвращает 1, не зажата 0.
Прошу направить на путь истенный. т.к я на 100% уверен что что-то не так делаю.
import time import datetime import telepot import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) GPIO.setup(16,GPIO.IN) def handle(msg): chat_id = msg['chat']['id'] command = msg['text'] print('Got command: %s' % command) if GPIO.input(16) == 1: bot.sendMessage(chat_id, str('/ring)')) time.sleep(3) elif command == '/status': bot.sendMessage(chat_id, str('online')) elif command == '/open': bot.sendMessage(chat_id, str('moving')) elif command == '/time': bot.sendMessage(chat_id, str(datetime.datetime.now())) bot = telepot.Bot('*********') bot.message_loop(handle) print('I am listening ...') while 1: time.sleep(10)