import RPi.GPIO as GPIO
import My_Rpi_GPIO_Lib_V1_0 as my
import time
import sys
import select
GPIO.setmode(GPIO.BCM)
for i in my.LED_Pin:
GPIO.setup(i,GPIO.OUT)
t_cnt = list(range(0, 256))
cnt = 0
try:
while True:
# 실습7 == env Count
if cnt %2 == 0: my.byte_out(cnt)
cnt = cnt+1
time.sleep(0.3) #delay 1second
'''
# 실습 6
for i in range(0, 8):
my.d_out(my.LED_Pin[7-i], GPIO.LOW)
time.sleep(0.3) #delay 1second
for i in range(0, 8):
GPIO.output(my.LED_Pin[7-i],GPIO.HIGH)# digitalWrite HIGH
time.sleep(0.3) #delay 1second
'''
"""
#실습 5
for i in t_cnt:
print("DN Cnt = {}".format(t_cnt[255-i]))
my.byte_out(t_cnt[255-i])
time.sleep(0.2) #200ms
"""
'''
#실습 4
for cnt in range(0, 256):
my.byte_out(cnt)
print("UP","DN", sep = ", / ", end = " Count\r\n")
print(f"Count = {cnt}")
print(f"DN-Count = {255-cnt}", end = "")
print(", song", end = "@@'\r\n")
print("Cnt = %d" %cnt)
print("UP++ Cnt = %s" %cnt)
print("UP Count = {0}, Dn Cnt = {1}".format(cnt, 256-cnt))
time.sleep(0.2) #200ms
'''
'''
#실습 3
my.byte_out(0x55)
time.sleep(0.2) #200ms
my.byte_out(0xaa)
time.sleep(0.2) #200ms
'''
'''
# 실습 2
my.pin_out(my.__LED_1__, GPIO.LOW)
my.pin_out(my.__LED_3__, GPIO.LOW)
time.sleep(0.2) #200ms
my.pin_out(my.__LED_1__, GPIO.HIGH)
my.pin_out(my.__LED_3__, GPIO.HIGH)
time.sleep(0.2)
'''
'''
# 실습 1
for i in my.LED_Pin:
#GPIO.output(i,GPIO.LOW)# digitalWrite LOW
my.d_out(i, GPIO.LOW)
time.sleep(1) #delay 1second
for i in my.LED_Pin:
GPIO.output(i,GPIO.HIGH)# digitalWrite HIGH
time.sleep(1) #delay 1second
'''
# a = input()
# if a == 'q':# any key input and enter
# break# exit while
except KeyboardInterrupt:
pass
finally:
GPIO.cleanup()
첫댓글 감사합니다