File tree 2 files changed +20
-8
lines changed
2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -22,20 +22,28 @@ def cb4(t):
22
22
return cb4
23
23
24
24
# create a timer with a callback, using callback(None) to stop
25
- tim = Timer (1 , freq = 1000 , callback = cb1 )
26
- pyb .delay (10 )
25
+ tim = Timer (1 , freq = 100 , callback = cb1 )
26
+ pyb .delay (5 )
27
+ print ("before cb1" )
28
+ pyb .delay (15 )
27
29
28
30
# create a timer with a callback, using deinit to stop
29
- tim = Timer (2 , freq = 1000 , callback = cb2 )
30
- pyb .delay (10 )
31
+ tim = Timer (2 , freq = 100 , callback = cb2 )
32
+ pyb .delay (5 )
33
+ print ("before cb2" )
34
+ pyb .delay (15 )
31
35
32
36
# create a timer, then set the freq, then set the callback
33
37
tim = Timer (4 )
34
- tim .init (freq = 2000 )
38
+ tim .init (freq = 100 )
35
39
tim .callback (cb1 )
36
- pyb .delay (10 )
40
+ pyb .delay (5 )
41
+ print ("before cb1" )
42
+ pyb .delay (15 )
37
43
38
44
# test callback with a closure
39
- tim .init (freq = 3000 )
45
+ tim .init (freq = 100 )
40
46
tim .callback (cb3 (3 ))
41
- pyb .delay (10 )
47
+ pyb .delay (5 )
48
+ print ("before cb4" )
49
+ pyb .delay (15 )
Original file line number Diff line number Diff line change
1
+ before cb1
1
2
cb1
3
+ before cb2
2
4
cb2
5
+ before cb1
3
6
cb1
7
+ before cb4
4
8
cb4 3
You can’t perform that action at this time.
0 commit comments