-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sx1509_voorbeeld.py
41 lines (32 loc) · 1.03 KB
/
sx1509_voorbeeld.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import utime
import random
from machine import Pin, PWM, ADC
import esp
import gc
esp.osdebug(None)
gc.collect()
class mainAPP:
def __init__(self):
self._adc_pin = 13
self._adc = (Pin(self._adc_pin))
random.seed(1024)
def main(self):
aantalLoops = 1000/60 * 60 * 60 * 24
led = PWM(Pin(self._adc_pin))
led.freq(500)
for i1 in range(0, aantalLoops):
duty1 = int(random.random()*1000)
for dutCnt1 in range(1, int(random.random()*100)):
led.duty(duty1)
utime.sleep_ms(int(random.random()*100))
led.duty(0)
sleepTime1 = int(random.random()*1000)
print(f'sleepTime1: {sleepTime1}ms')
utime.sleep_ms(sleepTime1)
if(i1 % 10 == 0):
print("Led knipperen op PIN=",self._adc_pin , i1,"van",aantalLoops)
if __name__ == '__main__':
print("App start")
main1 = mainAPP()
main1.main()
print("App eind")