wiki:Watch_dog_for_RPi_Python_RPi

Version 3 (modified by aoki, 9 years ago) ( diff )

--

Raspberry Pi上のサンプルプログラム(Python)

Raspberry Pi上のPythonによるサンプルプログラムです。

プログラムの動作は、「1秒に一回、GPIO17にパルスを1回出す。」です。

  • 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)
    
    
    
Note: See TracWiki for help on using the wiki.