File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ class Timer -- control internal timers
3131 tim = Timer(1, mode=Timer.PERIODIC)
3232 tim_a = tim.channel(Timer.A, freq=1000)
3333
34- led = Pin('GPIO2', af=0, mode=Pin.OUT)
34+ led = Pin('GPIO2', mode=Pin.OUT)
3535
3636 def tick(timer): # we will receive the timer object when being called
3737 print(timer.time()) # show current timer's time value (is microseconds)
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ See :ref:`machine.Pin <machine.Pin>`. ::
3030
3131 from machine import Pin
3232
33- # initialize GP2 in gpio mode (af =0) and make it an output
33+ # initialize GP2 in gpio mode (alt =0) and make it an output
3434 p_out = Pin('GP2', mode=Pin.OUT)
3535 p_out.value(1)
3636 p_out.value(0)
@@ -54,7 +54,7 @@ See :ref:`machine.Timer <machine.Timer>` and :ref:`machine.Pin <machine.Pin>`. :
5454 tim_a.time() # get the value in microseconds
5555 tim_a.freq(1) # 1 Hz
5656
57- p_out = Pin('GP2', af=0, mode=Pin.OUT)
57+ p_out = Pin('GP2', mode=Pin.OUT)
5858 tim_a.irq(handler=lambda t: p_out.toggle())
5959
6060PWM (pulse width modulation)
@@ -66,7 +66,7 @@ See :ref:`machine.Pin <machine.Pin>` and :ref:`machine.Timer <machine.Timer>`. :
6666 from machine import Pin
6767
6868 # assign GP25 to alternate function 9 (PWM)
69- p_out = Pin('GP25', mode=Pin.AF, af =9)
69+ p_out = Pin('GP25', mode=Pin.AF, alt =9)
7070
7171 # timer 2 in PWM mode and width must be 16 buts
7272 tim = Timer(2, mode=Timer.PWM, width=16)
You can’t perform that action at this time.
0 commit comments