2-test 7 random numpy
import RPi.GPIO as GPIO
import time
import random
import numpy as np
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(2,GPIO.OUT) #D 7448 P6
GPIO.setup(3,GPIO.OUT) #C 7448 P2
GPIO.setup(4,GPIO.OUT) #B 7448 P1
GPIO.setup(17,GPIO.OUT) #A 7448 P7
GPIO.setup(22,GPIO.OUT) #dark 7448 P4
GPIO.setup(27.GPIO.IN) #button ref->book A P133
while True:
value01= GPIO.input(27)
if value01 = 1:
flag = 1
display_num = random.randint(0,9)
while flag:
for i in range(0,100,5):
display_num = display_num + 1
display_num = display_num % 10
sumtime = np.tanh(i/100.0)
print("This prints ==> ." ,sumtime," Num:",display_num)
time.sleep(sumtime) # Delay for 1 minute (60 se
if sumtime > 0.7: #stop the while loop
flag = 0
break
print("End of run")