#!/usr/bin/env python # -*- coding: utf-8 -*- import OPi.GPIO as GPIO from time import sleep GPIO.setboard(GPIO.ZERO) GPIO.setmode(GPIO.BOARD) print(GPIO.gpio_function(3)) sleep(0.1) GPIO.setup(3, GPIO.IN) sleep(0.1) print(GPIO.gpio_function(3)) sleep(0.1) GPIO.cleanup()
def index(): if (GPIO.gpio_function(port) == 0): led_status = "Led Off" else: led_status = "Led On" return render_template("index.html", message = led_status)