Created
November 1, 2015 07:13
-
-
Save ks-t0/5fb13fde7fedc2786310 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# ライブラリ呼び出し部 | |
import RPi.GPIO as GPIO # GPIOライブラリを呼び出し | |
import time # 時間関連のライブラリを呼び出し | |
# 初期設定部 | |
GPIO.setmode( GPIO.BOARD ) # GPIOを端子番号で指定する | |
GPIO.setup( 40, GPIO.IN ) | |
# プログラム本体 | |
while True: # 繰り返しを行う | |
if GPIO.input( 40 ) == GPIO.HIGH : | |
time.sleep(0.2) # 0.2秒待機する | |
print "OK" | |
else : | |
print "NG" | |
time.sleep(0.2) # 0.2秒待機する |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment