示例#1
0
文件: 08.py 项目: onionys/python_code
#!/usr/bin/env python3

import os
from flask import Flask
from flask import request
from flask import send_from_directory
import edu

app = Flask(__name__)

led1 = edu.led(13)
led2 = edu.led(15)
btn1 = edu.button(16)
btn2 = edu.button(18)
buzzer = edu.buzzer(32)
relay = edu.relay(11)


@app.route("/")
def index():
    with open("./html/index.html") as f :
        res = f.read()
    return res


@app.route("/test")
def test():
    return "TEST PAGE"


@app.route("/html")
示例#2
0
#!/usr/bin/env python3

import os
from flask import Flask
from flask import request
from flask import send_from_directory
import edu

app = Flask(__name__)

led1 = edu.led(13)
led2 = edu.led(15)
btn1 = edu.button(16)
btn2 = edu.button(18)
buzzer = edu.buzzer(32)
relay = edu.relay(11)


@app.route("/")
def index():
    with open("./html/index.html") as f:
        res = f.read()
    return res


@app.route("/test")
def test():
    return "TEST PAGE"


@app.route("/html")
示例#3
0
文件: maker3.py 项目: yiminko/Maker3
    global led2
    global lcm
    global ser
    if(GPIO.input(led2.pin) == 1):
        led2.off()
        ser.write("led2.0 ")
        
    elif(GPIO.input(led2.pin) == 0):
        led2.on()
        ser.write("led2.1 ")
    lcm.line2_msg = 'btn2 pressed'



if __name__ == "__main__":
    btn1 = edu.button(button1_pin, btn1_func)
    btn2 = edu.button(button2_pin, btn2_func)
    lcm.run()

    operations = {
            'led1.1'   : led1.on,
            'led1.0'   : led1.off,
            'led2.1'   : led2.on,
            'led2.0'   : led2.off,
            'relay.1'  : rel.on,
            'relay.0'  : rel.off,
            'buzzer.1' : buz.on,
            'buzzer.0' : buz.off,
            'shutdown' : shutdown,
            }