NuMakerMar 29, 2019 Page 24 of 31 Rev 1.00NUMICROPY USER MANUALLED ClassThe LED object controls an individual LED. Table 5-7 is LED support list by the board.Board LED Name Board Pin Name CPU Pin NameNuMaker_PFM_M487 led0 LEDR H0led1 LEDY H1led2 LEDG H2Table 5-7 LED Support List1. from pyb import LED2.3. led = LED('led0') # create an LED object4. led.off() # turn the LED off5. led.on() # turn the LED on6. led.toggle() # toggle the LED between on an offSwitch ClassA Switch object is used to control a push-button switch. Table 5-8 is switch support list by theboard.Board Switch Name Board Pin Name CPU Pin NameNuMaker_PFM_M487 sw2 SW2 G15sw3 SW3 F11Table 5-8 Switch Support List1. from pyb import Switch2.3. sw = Switch('sw2') # create a switch object4. sw.value() # get state (True if pressed, False otherwise)5. sw() # shorthand notation to get the switch state6.7. def sw2_callback():8. print('sw2 press')9.10. sw.callback(sw2_callback) # register a callback to be called when the switch ispressed down11. sw.callback(None) # remove the callbackTimer ClassEach timer consists of a counter that counts up at a certain rate. When the counter reaches thetimer period it triggers an event, and the counter reset back to zero. By using the callback method,the timer event can call a Python function.1. from pyb import Pin2. from pyb import Timer3.4. def tick(timer):5. print(timer.counter())6.7. tim = Timer(3, freq = 2) # create a timer object using timer 3 and trigger at 2Hz