読者です 読者をやめる 読者になる 読者になる

主に、強化学習

情報系の大学2年生が確率に関連したことを多めに書いてるブログ

Raspberry Pi (Memo )

First

 I wanna create Ranking in イライラ棒 with Raspberry Pi and Flask. This article is only my memo. So, not meaningful with you.

Raspberry Pi

#!/usr/bin/env python2.7  
import RPi.GPIO as GPIO  
import os
from flask import Flask

app = Flask(__name__)

"""
getime = lambda time1,time2: time1 + time2*5
"""


@app.route('/hello/')
@app.route('/hello/<name>')
def hello(name=None):
 return render_template('hello.html',name=name)

GPIO.cleanup() #initialize the function.
GPIO.setmode(GPIO.BCM)  #set the Broadcom chip.

GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)   #output to 11ports when pull up.
GPIO.setup(4, GPIO.IN, GPIO.OUT ) #setting 7ports → Output
#GPIO.output(4, GPIO.HIGHT) # 7port of state into HIGH

#GPIO.setup(9 , GPIO.IN)
#if ( GPIO.input( 9 ) == 1 )  --> examine the input of 21port, and if it is True, implement next.  

while True:
 try:  
         GPIO.wait_for_edge(23, GPIO.FALLING)  #
 except KeyboardInterrupt:  
         GPIO.cleanup()  # clean up GPIO on CTRL+C exit  
 GPIO.cleanup()          # clean up GPIO on normal exit  
 os.system("/sbin/shutdown -h now")

What's the different in "GPIO.FALLING" and "GPIO.input".