Data Sheet

14
The Crowtail- LED will be blink eve ry 0.2 second.
Why th e led blin k every 0.2 secon d? How to cont rol it keep li ghti ng mo re longer?
Now let me tell you. In this demo code, first de fine th e gpi o1 int o output port ,
the n let the gpio 1 co nstant ly switch bet ween high and low level , set the time
int er val as 0.2 second and make it cyc le. You can chan ge the tmr.delay ( )
param eter in the program to chan ge the inte rv al.
Demo code:
fu n c t io n in i t _ L E D ( )
gp i o . m o de ( 1 , gpi o .O U T P U T ) -- S e t th e po r t mo de
en d
wh i l e (1 ) do
gp i o .w r it e( 1 , g p i o . H I G H ) -- gp i o 5 is th e po r t 1
tm r.d e l ay ( 2 0 0 0 00 ) -- d el a y 0.2 s
gp i o .w r it e( 1 , g p i o . LOW )
tm r.d e l ay ( 2 0 0 0 00 )
en d
In this lesson we learn the following function.
gp i o.mod e ()
gp i o.wri te()
tmr.delay ()
Lesson2 : Button Control LED
In the lesson1, we have learned how to control a led turn on for one second, and turn off for one
second. Do you want to control it yourself by using the button? In this lesson, we will tell you how