Raspberry Pi上のサンプルプログラム(Python)
Raspberry Pi上のPythonによるサンプルプログラムです。
プログラムの動作は、「1秒に一回、GPIO17にパルスを1回出す。」です。
ウォッチドッグ基板と連携をとる場合には、このGPIOにパルスを出すプルグラムを自動的に起動する必要があります。 こうする事で、Raspberry Piがリブートした場合にもウォッチドック機能を自動的に再利用できるようになります。
- blink17.py
#!/usr/bin/env python import RPi.GPIO as GPIO import time LEDPIN = 17 GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) GPIO.setup(LEDPIN, GPIO.OUT) while True: LEDon = GPIO.output(LEDPIN, 0) time.sleep(0.5) LEDoff = GPIO.output(LEDPIN, 1) time.sleep(0.5)
Last modified
9 years ago
Last modified on Jun 12, 2015 5:59:09 PM
Note:
See TracWiki
for help on using the wiki.