Build real-world gaming hardware with TinyGo
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Subtitle |
| |
Title of Series | ||
Number of Parts | 490 | |
Author | ||
License | CC Attribution 2.0 Belgium: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor. | |
Identifiers | 10.5446/47297 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
FOSDEM 2020408 / 490
4
7
9
10
14
15
16
25
26
29
31
33
34
35
37
40
41
42
43
45
46
47
50
51
52
53
54
58
60
64
65
66
67
70
71
72
74
75
76
77
78
82
83
84
86
89
90
93
94
95
96
98
100
101
105
106
109
110
116
118
123
124
130
135
137
141
142
144
146
151
154
157
159
164
166
167
169
172
174
178
182
184
185
186
187
189
190
191
192
193
194
195
200
202
203
204
205
206
207
208
211
212
214
218
222
225
228
230
232
233
235
236
240
242
244
249
250
251
253
254
258
261
262
266
267
268
271
273
274
275
278
280
281
282
283
284
285
286
288
289
290
291
293
295
296
297
298
301
302
303
305
306
307
310
311
315
317
318
319
328
333
350
353
354
356
359
360
361
370
372
373
374
375
379
380
381
383
385
386
387
388
391
393
394
395
397
398
399
401
409
410
411
414
420
421
422
423
424
425
427
429
430
434
438
439
444
449
450
454
457
458
459
460
461
464
465
466
468
469
470
471
472
480
484
486
487
489
490
00:00
Menu (computing)HypermediaBuildingComputer hardwareTerm (mathematics)CompilerFormal languageComputer programmingCompilerWeb browserWhiteboardComputer programReal numberEEPROMSource codePlastikkarteComponent-based software engineeringPressureDistanceModulo (jargon)SequenceCodeSequenceElectronic visual displayProjective planeGame theoryGraph coloringRoundness (object)SubsetRevision controlDifferent (Kate Ryan album)Multiplication signLink (knot theory)InformationSlide ruleCompilerMultilaterationComputer programmingMereologyFlow separationBuildingReal-time operating systemComputer hardwareComputerMicrocontroller
04:15
Menu (computing)CodeComponent-based software engineeringWritingThomas KuhnCompilerAsynchronous Transfer ModeWhiteboardWhiteboardFunction (mathematics)Normal (geometry)CodeDifferent (Kate Ryan album)Device driverPersonal identification numberComputer hardwareFunctional (mathematics)ComputerVirtual machineComputer animation
07:21
State of matterCodeExpressionMultiplication signFlash memoryComputer animation
08:08
Computer programmingComputer animation
08:58
Component-based software engineeringGame theoryTouchscreenMenu (computing)Matrix (mathematics)CodeReading (process)AnalogyPixelMathematicsElectronic visual displayAsynchronous Transfer ModeWhiteboardCompilation albumConvex hullVideo game consoleInclusion mapAnalogyInterface (computing)Normal (geometry)TouchscreenCodeBootingPortable communications deviceSerial portPixelPeripheralReal-time operating systemGraph coloringConfiguration spaceData conversionPersonal identification numberIntegerDevice driverGame theoryElectronic visual displayVideo game consoleInternet der DingeVirtual machineMatrix (mathematics)Endliche ModelltheorieFlash memoryGeometryoutputComputer configurationMereology
12:42
Stapeldatei
13:23
Game theoryPortable communications deviceVideo game consoleComputer configurationComponent-based software engineeringElectronic visual displayGame theoryStapeldateiComputer configurationComputer animation
14:09
Binary fileCodeGame theory
14:53
Electric currentComputer fontRobotComputer programSource codeComputer programmingMenu (computing)MaizeMoment of inertiaConvex hullNormed vector spaceCompilerFlow separationDifferent (Kate Ryan album)Duality (mathematics)Group actionOpen setRoboticsBuffer solutionProjective planeMicrocontrollerHydraulic motorAdditionCodeDevice driverOpen sourceTouchscreenComputer programmingComputer hardwareComputer animation
17:52
Buffer solutionComputer animation
18:31
Open setCodeWhiteboardBit rateAsynchronous Transfer ModeSimulationCompilation albumTrailoutputInternet der DingeFunction (mathematics)Control flowTurbo-CodeCondition numberAddress spaceMicrocontrollerProjective planeTrailData storage devicePersonal identification numberSinc functionDifferent (Kate Ryan album)Open setGraph coloringComputer hardwareoutputComputer animation
21:50
Moment (mathematics)Computer animation
22:52
Open setMenu (computing)Source codeLink (knot theory)Bit rateError messageDigital electronicsComputer fileProjective planeComputer animation
23:57
FacebookOpen sourcePoint cloud
Transcript: English(auto-generated)
00:14
Cool, so it's 10.30, so we can start. OK, so next up we have Daniel who's going to be talking about TinyGo and how to build toys with TinyGo and lots of hardware.
00:23
So round of applause for him, please. Hello, I'm Daniel Esteban, also known as Conejo. And I will talk today about building toys or games, devices, with TinyGo.
00:42
And a maker is like, I make things on my free time, usually involving electronics. And maybe you are asking, what is TinyGo? TinyGo is not a subset or a superset of Go. It's the same language. It's just a new compiler that targets a very, very
01:04
small place. We released version 0.12 two days ago. If you want to know more about TinyGo, you could check the link there about the last year at Fosden, also talk from Ron Evan.
01:23
And no, we are sponsored by Google. When I talk about small places, I talk about this kind of microcontroller. They are really small. Maybe you should see this, some of you.
01:40
But it's like Arduino, BBC Microbit, some of the Adafrid, like Itsy Bitsy or Secret Playground Express. TinyGo also compiles your Go program to smartwatches, like the Pine Time.
02:02
Just go to the AW building and check the Pine64 booth stand they have there. We have support for several other devices, sensors, and actuators, like RGB LEDs, real-time clock, humidity,
02:24
temperature sensor, sound, light sensor, distance, a lot of things. And also, a lot of displays. If you don't have any bar or jet or you don't have any devices to play,
02:43
we also have Playground. We simulate some of the bar, and you could try TinyGo without installing anything on your computer. So what are you going to see today?
03:01
Well, some small toys, some fun-to-make projects that you could do at home. All the information is on the slide I will upload later. I will just go over the highlights or the main different parts that you need, the basic you need to make this project.
03:23
So the first one is the Go First Day. I don't know if you know this game is called Simon. Sometimes it plays a different tone and lights a different color, and you need to match that color.
03:42
And it will be going a longer sequence each time. For the Simon, it's very simple.
04:04
We'll only use three buttons and three LED and some printed bar. And I will just use an Adafruit Playground Express, which is this little bar.
04:27
Our Go code, we start with the import. We just need to import the main package, the machine package, which is a special one to talk to the hardware.
04:41
And we also are going to import like tinygo.rx driver busser, which is to make sound. To set up the LED, we just define an LED like mhin.a1 or a2 or maybe d12,
05:05
because it's the pin number on your board. We configure it as an output pin here. And to enable the LED, it's as simple as LED.high or LED.low
05:25
to disable it. For the three buttons, it's very similar also.
05:41
But instead of output, we configure them as an input. And just to check the status of the button, is it pressed or not? Yes, we do button.get. And it will return true, false. For the busser, which is a small speaker that makes sound,
06:05
again, we define the busser pin. We configure it as an output. And then we create a busser device. And to play a song, it's as simple
06:22
as just call the function tone with a note and a duration of that note. The rest of the code is your normal Go code.
06:41
There is no difference there. And since it's a bit longer than I wanted to, I will not show. But it's already in the slide and in the tab to check it. But you will check it's the same. It's the same as Go and it's no difference.
07:03
To flash it on your board, so it's program, you usually just connect it to your computer and normally you double press the rest of the buttons. So it's your, in this case, the secret playground
07:23
is press enter the programmable state. And then it's, I'm sorry.
07:41
And I don't know how to change it now. I could make bigger. So to flash it is just as simple as timing Go flash. You just specify your target. In this case, the secret play express
08:02
and the code you are going to flash. We wait out detail. It has a battery, so.
08:29
And now we have our Go program here. It will play and it will go longer and longer.
08:48
It's for the next one.
09:03
I don't know, probably you know the game called Pong. It's sometimes a hockey game. We just need a display. This one is not so tiny. It's a little big. Actually this is one like,
09:20
you could put one several together and make those big billboard on the street or in the stadium. It's supported by TinyGo. And also for this case, I just add a real time clock. So actually the game is playing itself
09:42
while showing the hour and when it's time, one player or the other will lose. For the game, we just need two percent geometers. I use them as knob here.
10:01
They are analog input. We also use that huge LED matrix. And in this case, I choose an Arduino Nano 33 IoT. And as I said, a real time clock optional. Again, the import part is you just need
10:21
to import the machine package. The driver for the HUB-75, which is the LED matrix. The driver for the real time clock. And the tiny phone package, which is a special package also that allow us to draw text on every TinyGo display supported.
10:45
For the analog input, it's very similar as the bottom of the previous example. In this case, we need to initialize the analog to digital converter. But the thing is, we just choose a pin and configure it.
11:02
And instead of true, false, now we are getting an integer variable depending on the value of the analog for the screen. Also, quite simple, we define a serial peripheral interface, SPI interface for the screen.
11:24
And we create a HUB-75, which is the screen device. We make some configuration of the displays, but then we just call, like we could change each pixel with set pixel. Just the X, Y coordinates and the color.
11:50
Again, you write the rest of the code, you put it in boot log model and flash it. And there you have it, here.
12:10
For the real-time clock, again, in this instead of SPI interface and I2C, we configure it and we just use like,
12:21
you will see, I mean, you are seeing that this is normal Go code. For third project, we could make portable game console.
12:42
You have some option. This is, we are also using this as batch.
13:10
It's a little blurry, sorry.
13:28
Yeah, I put the GIF there, it goes better. You have several options here. You could make a homemade one with a spare part you have
13:40
or you could buy us, there are some more like this. This is a Pi batch, but there are also pay gammer or each batch. Like more or less, as long as it has an display and some buttons, you could make your own games.
14:00
Of course, if you want something more professional looking, you could use a Game Boy Advance because actually, it's right.
14:24
We just compile a Go code and it's running on a Game Boy Advance. I cannot tell you exactly how you should put
14:40
your binary files there. Maybe it's not really legal, but, and for your games, you could use Tiny Draw. It's a package to make simple primitive
15:04
on every screen that is supported by Tiny Go right now. We also have Tiny Phone, which is to write text on the displays also.
15:28
The last two projects, I like a lot. They are community projects. They are also open source and open hardware. The first one is called Scornabot, which means beetles.
15:44
It's an educational robot similar to a Bebot or a Cubetto and it's great. And I mean, it's being used in a school right now to introduce young children into programming.
16:01
Children are not programming the robot itself, but they are just using the top buttons here to make the robot move or turn. It doesn't that much. Just you, the children click the button,
16:22
like move forward one step or two step, then turn right, then go backward. As I said, it's being used in a school. If it's not the Scornabot, it's usually the Bebot or Cubetto. They have several different activities with them.
16:45
For the robot, you just, the most important is you just need two stepper motor, five buttons, one buffer to make sound, which is optional, some 3D printed bar, and microcontroller.
17:04
The different, I mean, we already see how to use the button and the only addition to this project is the use of two motors with the easy stepper driver.
17:21
In this case, if you have one motor, it's just create a new easy stepper device, just configure and just tell the motor to move 200 step. But we have two, so instead we use easy stepper new dual device and just tell them move.
17:48
Again, we flash the code and see in action. In this case, it's a little buffer.
18:00
So we just tell them to go forward, turn right, and then come back, and it's moving.
18:44
The last project is possibly my favorite. It's called Open LED Race. It's also a community project. It's open store and open hardware. You just create a race track with LED strip,
19:03
and then make the different LED move. You simulate a race with any input. For this, you need an addressable LED strip,
19:20
anything as an input, and just a microcontroller. The only difference here is the WS2812, which is the LED strip. Just select the pin for the output, create a new device, and you just write the color
19:44
you want to appear on the LED strip. I will need two volunteers that want to compete in the game, and just win some hardware we have to give away. So if you know how to click a button, please,
20:05
raise your hand. Just check, both of you, okay. Again, since it's an open hardware project and community-driven, I said you could use
20:20
anything as an input. So people is doing different kind of things. We just simulate the track. In this case, on the left picture, we simulate the gravity, so we are creating a virtual slope that will slow your car
20:43
on one side and speed it up on the other. Also, in this case, Arduino Nano has a Wi-Fi chip, so why not add Wi-Fi to your project
21:00
and have telemetry data like the professional. And if the Wi-Fi works, you are going to be
21:45
the red golfer, you are going to be, wait.
22:04
Okay, wait a moment.
22:26
Okay, it's too much. Yeah, wait. I don't know if it will be working, but we'll see. Just, oh, it's not working, but press the button.
22:41
Yes, and for both of you, this Arduino Nano
23:08
is compatible and you could make this. So, as I said, everything is here. Everything is here, all the projects just here
23:26
are working and are on GitHub right now. And if you just like, join us at TinyGo channel of Slack. Thank you.