树莓派控制led灯闪烁

为什么80%的码农都做不了架构师?>>>   hot3.png

操作gpio基础

#!/usr/bin/env python
# coding: utf-8

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

import time
import RPi.GPIO as gpio

gpio.setmode(gpio.BCM)

pin = 14
gpio.setup(pin, gpio.OUT)

for i in range(10):
    gpio.output(pin, True)
    time.sleep(0.1)
    gpio.output(pin, False)
    time.sleep(0.1)

gpio.cleanup()


 

转载于:https://my.oschina.net/yehun/blog/1633496

你可能感兴趣的:(树莓派控制led灯闪烁)