Advertisement
Guest User

1 led blinking raandomly

a guest
Feb 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. ## 1 led blinkin random loop
  2.  
  3. from gpiozero import LED
  4. from time import sleep
  5.  
  6. ## random function
  7. import random
  8.  
  9. red_led = LED(17)
  10.  
  11. while True:
  12.  
  13. ## defined two variables that change value at each loop
  14.     light_on = random.random()
  15.     light_off = random.random()
  16.  
  17. ## printing the random numbers
  18.     print(light_on)
  19.     print(light_off)
  20.  
  21. ## here's the led blinking using the variables
  22.     red_led.blink(light_on, light_off)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement