• sales

    +86-0755-88291180

Case of use #2

2025-04-10 09:08:17 Ask

Just an example of use:


# +------------------------------------------------------------+

# |       K5            ---------      L16  L12  L08  L04  L00 |

# |      [16]          /    AD   \    [11] [15] [20] [22] [28] |

# |                   /     .     \                            |

# | K4    K2    K3   |     /|\     |  [10] [18] [19] [21] [27] |

# |[17]  [13]  [14]  |      .      |                           |

# |                  |      |      |  [09] [07] [05] [03] [01] |

# |       K1          \     |     /                            |

# |      [12]          \   [26]  /    [08] [06] [04] [02] [00] |

# |                     ---------                              |

# +------------------------------------------------------------+

#

# [XX] - GPIOXX


from machine import Pin

import time


Blink = Pin("LED", Pin.OUT) # ONBOARD LED


led=[28,27,01,00,22,21,03,02,20,19,05,04,15,18,07,06,11,10,09,08]


Pin(led[00], Pin.OUT) # 28

Pin(led[01], Pin.OUT) # 27

Pin(led[02], Pin.OUT) #  1

Pin(led[03], Pin.OUT) #  0

Pin(led[04], Pin.OUT) # 22

Pin(led[05], Pin.OUT) # 21

Pin(led[06], Pin.OUT) #  3

Pin(led[07], Pin.OUT) #  2

Pin(led[08], Pin.OUT) # 20

Pin(led[09], Pin.OUT) # 19

Pin(led[10], Pin.OUT) #  5

Pin(led[11], Pin.OUT) #  4

Pin(led[12], Pin.OUT) # 15

Pin(led[13], Pin.OUT) # 18

Pin(led[14], Pin.OUT) #  7

Pin(led[15], Pin.OUT) #  6

Pin(led[16], Pin.OUT) # 11

Pin(led[17], Pin.OUT) # 10

Pin(led[18], Pin.OUT) #  9

Pin(led[19], Pin.OUT) #  8


print("")

print("+------------------------------------------------------+")

print("| The display will show numbers from 0 to 9 in a loop! |")

print("+------------------------------------------------------+")


#--------------------------------------------

def Number0():

#         0 - ZERO

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).high()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).low()

Pin(led[10], Pin.OUT).low()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).high()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number1():

#         1 - ONE

Pin(led[00], Pin.OUT).low()

Pin(led[01], Pin.OUT).low()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).low()

Pin(led[04], Pin.OUT).low()

Pin(led[05], Pin.OUT).high()

Pin(led[06], Pin.OUT).high()

Pin(led[07], Pin.OUT).low()

Pin(led[08], Pin.OUT).low()

Pin(led[09], Pin.OUT).low()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).low()

Pin(led[12], Pin.OUT).low()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).high()

Pin(led[15], Pin.OUT).low()

Pin(led[16], Pin.OUT).low()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number2():

#         2 - TWO

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).low()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).high()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).low()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number3():

#         3 - THREE

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).low()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).low()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number4():

#         4 - FOUR

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).low()

Pin(led[02], Pin.OUT).low()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).high()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).low()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).low()

Pin(led[17], Pin.OUT).low()

Pin(led[18], Pin.OUT).low()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number5():

#         5 - FIVE

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).high()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).low()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).low()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number6():

#         6 - SIX

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).high()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).low()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).high()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number7():

#         7 - SEVEN

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).low()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).low()

Pin(led[09], Pin.OUT).low()

Pin(led[10], Pin.OUT).low()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).low()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).low()

Pin(led[17], Pin.OUT).low()

Pin(led[18], Pin.OUT).low()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number8():

#         8 - EIGHT

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).high()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).high()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def Number9():

#         9 - NINE

Pin(led[00], Pin.OUT).high()

Pin(led[01], Pin.OUT).high()

Pin(led[02], Pin.OUT).high()

Pin(led[03], Pin.OUT).high()

Pin(led[04], Pin.OUT).high()

Pin(led[05], Pin.OUT).low()

Pin(led[06], Pin.OUT).low()

Pin(led[07], Pin.OUT).high()

Pin(led[08], Pin.OUT).high()

Pin(led[09], Pin.OUT).high()

Pin(led[10], Pin.OUT).high()

Pin(led[11], Pin.OUT).high()

Pin(led[12], Pin.OUT).low()

Pin(led[13], Pin.OUT).low()

Pin(led[14], Pin.OUT).low()

Pin(led[15], Pin.OUT).high()

Pin(led[16], Pin.OUT).high()

Pin(led[17], Pin.OUT).high()

Pin(led[18], Pin.OUT).high()

Pin(led[19], Pin.OUT).high()

#--------------------------------------------

def ToggleTime():

   Blink.toggle()

   time.sleep(.2)

#--------------------------------------------

while True:

   Number0()

   ToggleTime()

   Number1()

   ToggleTime()

   Number2()

   ToggleTime()

   Number3()

   ToggleTime()

   Number4()

   ToggleTime()

   Number5()

   ToggleTime()

   Number6()

   ToggleTime()

   Number7()

   ToggleTime()

   Number8()

   ToggleTime()

   Number9()

   ToggleTime()

#--------------------------------------------

Pico all gpio test
0answers