This is good for beginners because the code and schematic is very simple using micropython and Thonny Tool.
The basic firmware used the *.uf2 file in the link below.
https://github.com/Wiznet/RP2040-HAT-MicroPython/releases
AndNext, I'm going to use a switch to show numbers and to send 6 numbers as data through a TCP connection.
Now is possible to output the range of numbers (from 1 to 45)
The main feature of this project is the random routine the process is repeated so many times as necessary to complete the sequence of draw numbers.
while True:
num = random.randrange(1,46)
if num in result:
num = random.randrange(1,46)
result.insert(0,num)
# print("Again\r\n ")
else:
result.insert(0,num)
if 6 == len(result):
break
The picture is a screen in Thonny Tool.
It outputs randomly among the numbers from 1 to 45, and if the same number out of 6 numbers comes out, it is regenerated.
result.sort()
This function sorts 6 numbers in order.
Next, I'm going to use a switch to show numbers and to send 6 numbers as data through a TCP connection.
Comments