Learning Simple Programming for a Ten Year Old? - Page 1
Forum section: electronics / general

author: fourfathom
author_rank: Super Contributor
timestamp: November 11, 2022, 08:54:01 pm
content: My grandson is turning ten next month, and I would like to expose him to simple programming. I'm not trying to turn him into a "coder", but I remember my early experiences with computers and enjoying simple programming essentials such as counting, calculating squares and primes, even just "Hello World". I am looking for recommendations, probably not graphically-oriented, but simple BASIC or whatever the current thing would be. I want him to see the numbers and the logic.My first experience at that age (ten) was actually manually punching Hollerith cards -- I didn't really understand much of it, but it left an impression and a fascination that has stayed with me ever since. Later I learned BASIC, working with teletype. paper tape, and a minicomputer. I'm a hardware engineer, not a true programmer, computer scientist, or mathematician, but that early exposure made a big difference to me. I would like to give my grandson the same opportunity that I had, and I would be quite happy to mentor him. Perhaps it won't catch his interest, but it's worth giving it a try.Recommendations?

author: james_s
author_rank: Super Contributor
timestamp: November 11, 2022, 09:06:15 pm
content: BASIC is still around, that's what I was starting to dabble in at that age.Python also has a very low barrier to entry, it can run in an interpreter and is nearly as easy to get started with as BASIC.There are also some games that are programming-like that might be easier to engage a younger kid with.

author: Gyro
author_rank: Super Contributor
timestamp: November 11, 2022, 09:12:08 pm
content: Maybe an opportunity to teach some simple hardware [Edit: interaction] at the same time. Take a look at Micromite / Picomite (Pi Pico version) BASIC...https://geoffg.net/micromite.html

author: BrianHG
author_rank: Super Contributor
timestamp: November 11, 2022, 09:16:41 pm
content: For a 32/64bit free Basic compiler, look here:https://www.freebasic.net/https://www.freebasic.net/forum/(Yes, you have an 'active' community forum with users today who can help you...)You get a free compiler Windows & Linux and even Dos if you want to make a program which fits on a single bootable floppy disc.Tons of source code examples on the forum.Includes 32bit graphics support, window interface, OS extensions and sound including things like OPenGL 2D and full 3D examples and .mp3 players including complete video games.I've also used it for full USB serial port control for my HDL/FPGA projects connected to my PC.Most dumb simple basic code works. The only new thing you might need to get used to is no line numbers, sub-routines are given labels/names. The other thing is you need to declare the variables you use at the beginning of your code.(Combo hardware/software things I have done with FreeBasic and a simple 3 wire TTL<->RS232 dongle include office monitor for temperature zones logging and controlling the furnace, Exercise bike generator workout tracking / charting, logging and scrolling scope of workout, FPGA hex editor / debugger and a few others...)

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 11, 2022, 09:33:12 pm
content: How about one of the maze-solving robots? LikeSparki?Kids nowadays have so much audiovisual stimuli that I think something concrete they can interact with physically as well as via programming, might be more likely to ignitethe spark.

author: _Wim_
author_rank: Super Contributor
timestamp: November 11, 2022, 09:43:14 pm
content: You might consider "Lego Wedo 2.0" (10 years might be a bit too old, but my son had much fun with when he was 8 ), or "Lego Mindstorms" (have not used that one).Lego Wedo that had lots of interactive challenges which made it fun to discover new functions, and the fact that it was controlled and "programmed" by his andriod tablet was big bonus!Those are expensive options however, but very well executed

author: Ian.M
author_rank: Super Contributor
timestamp: November 11, 2022, 10:09:22 pm
content: You probably should strongly consider leveraging the Arduino hardware platform, but obviously, at age 10 an interactive interpreter is vastly preferable to any compiled language. Therefore, taker a look at:https://create.arduino.cc/projecthub/sl001/basic-on-arduinos-5b4e24There are various other Arduino Basic interpreter projects, but IMHO many of them miss the point by defaulting to using a PS/2 keyboard and a low-res LCD or OLED for display. Back in the day, even the crappiest home computer had a 32 or 40 x 25 character display, often on the family TV so typically at least 14" diagonal, so programming on a crusty old keyboard while peering at a tiny LCD/OLED doesn't strike me as at all appealing!Using a PC running a terminal program for the UI and mass storage is far more attractive, and as skills develop can eventually lead on to conventional PC hosted development using a cross-compiler.The physical interactivity side of things can be handled by an Arduino based robotics kit, but unless there's an available play area with a large hard smooth floor, a robot arm or similar may be preferable to an autonomous robot buggy. If you do go down the buggy road, its well worth adding an ESP8266 WiFi module, which can be used to interact with the Arduino and even reprogram it remotely using esp-link:https://github.com/jeelabs/esp-linkpaired to the user's home WiFi, without the aggravations of a wired tether.

author: BrianHG
author_rank: Super Contributor
timestamp: November 11, 2022, 10:11:56 pm
content: Note I started Learning Atari Basic at the age of 11. If your son really wants to learn, Basic may be possible at the age of 10 with guidance. By the time I was 13, I was already fiddling with connecting my own hardware to my Atari 800 joystick ports and making software controlled hardware. In the summer of 84, I did teach in summer camp Atari & Apple Basic to campers as young as ~9 years old, so it is possible which they all really enjoyed as I taught them to rudimentary think how to break down a problem steps you can explain to others or a machine to perform what you want them to do.

author: jamesglanville
author_rank: Contributor
timestamp: November 11, 2022, 10:17:26 pm
content: I think something interesting that flashes/moves is much more interesting. There are only so many "hello world" programs you can write.An arduino and an led matrix or something might be a fun start.

author: fourfathom
author_rank: Super Contributor
timestamp: November 11, 2022, 10:43:07 pm
content: Thanks to all for the suggestions! At the moment my grandson is enthusiastic about Mario Bros and Zelda, and I will admit that the graphics and action is a huge draw. Perhaps some of the more interactive / graphical options mentioned would be more appealing, while still (I hope) introducing the purity and beauty of algorithms, logic, and numbers. But that might be too much to ask for at his young age. I'm not going to push him into something that doesn't interest him, so we shall see what works.BTW, I'm competent in more than a few programming modes; BASIC, assembly, Pascal, C, C#, etc., embedded and otherwise, so setting up that area and any hardware will be the easy part.

author: BrianHG
author_rank: Super Contributor
timestamp: November 11, 2022, 11:00:40 pm
content: If you look here:https://games.freebasic.net/listalpha.phpYou will find a ton of games. I know they are too complex to begin with, but it may help add interest.Some of these games have their source code available.Some fun games:Axiebal 7https://games.freebasic.net/dumpbyid.php?input=114(Though a 2D game, it renders the screen using 3D geometry. Surprisingly good graphics and music, fun, for anyone who likes a Marble Madness style game. (You can set the GFP to full 1080p res in the game options menu.))Asteroidshttps://games.freebasic.net/dumpbyid.php?input=148(This one includes the source code)

author: eti
author_rank: Super Contributor
timestamp: November 12, 2022, 12:03:43 am
content: I'd advise to skip that sterile, toxic and egotistical path (look at silicon valley types for confirmation of this) and maybe guide him into a PROPER engineering career, one where laws of physics.and constants are engineered, Vs the weekly whims of some gen X "engineer" at Google.Stand him in good stead by lighting the fire of enthusiasm for PHYSICAL WORLD OBJECTS & it's far more rewarding.

author: rstofer
author_rank: Super Contributor
timestamp: November 12, 2022, 12:06:06 am
content: BASIC is pretty much a dead issue. I would expect anything with feedback to be more entertaining. To that end, I recommend any of the 'arduino starter kits for kids' (yes, search Amazon for that phrase...)https://www.amazon.com/ELEGOO-Project-Tutorial-Controller-Projects/dp/B01D8KOZF4The tutorials start from the ever popular blinking LED up through motors, 7 segment displays and a host of other gadgets. The tutorials are great!The code is presented in C. The end goal is to build up the knowledge and confidence to move on to the robotics.I see the manufacturer thinks the kit is suitable for 10+. Clearly, it is going to depend on the kid and what level of interest they have.The thing about Arduino is that it is all over the place. There are thousands of projects to duplicate and coding is generally simple. Worst case, Copy-And-Paste works well.A wee bit of adult supervision in the early stages probably helps. The software installation is straightforward and printing "Hello World" is very well documented.https://arduinogetstarted.com/tutorials/arduino-hello-worldThere are many other tutorials at that site.I'm not aware of any version of BASIC that natively talks to stepper motors over GPIO pins. Maybe something could be done with the Raspberry Pi but I suspect it will be a lot of work. I did a lot of similar work with the 8080/8085 and Palo Alto Tiny Basic but that was about 40 years ago. We've moved on...

author: rstofer
author_rank: Super Contributor
timestamp: November 12, 2022, 12:11:35 am
content: I have a couple of these systems and they do indeed run Microsoft BASIC. "Some assembly required!" doesn't begin to cover it.https://rc2014.co.uk/

author: BrianHG
author_rank: Super Contributor
timestamp: November 12, 2022, 12:38:11 am
content: Quote from: eti on November 12, 2022, 12:03:43 amWe are talking about a 10 year old learning to develop a skill set, not decide their future life yet. Learning how to program can lead to learning physics as well.I say fourfathom should choose something they can do together.If fourfathom likes/knows Basic, or any other language, let him start there if he wants.I'm 100% self taught from the start. I went to programming first as a means to learn how to control hardware, though I did begin because of the games which were available on the Atari 800.

author: sokoloff
author_rank: Super Contributor
timestamp: November 12, 2022, 01:18:50 am
content: I'm a little surprised to see no one recommended scratch yet:https://scratch.mit.edu/My kids both took right to it and you can get a lot done that's graphical and interactive well before they get bored. I think they were doing it when they were 7 and 9, maybe. There's a lot of online scratch examples, you can examine other people's code and see how they did things, plenty of YouTube tutorials, and a kind of mashup of some of the best of old 8-bit BASIC, Logo, Hypercard, blockly-style programming, and good support for sprites with an actor model under the covers.Here's one we did together following a tutorial but then doing some extensions and customizations ourselves. (I'm not going to deny that I had a heavy role in keeping them unstuck or helping figure out what was going wrong, but they did all the driving on the keyboard and, based on projects they did afterwards alone, they understood most of what was going on.)Brick-breaker game in ScratchAnother one that the kids did much more on their own:Rainbow Chase

author: MikeK
author_rank: Super Contributor
timestamp: November 12, 2022, 01:33:19 am
content: Karel? Logo?

author: BrianHG
author_rank: Super Contributor
timestamp: November 12, 2022, 03:28:50 am
content: Quote from: MikeK on November 12, 2022, 01:33:19 amYes, I learned 'Logo' in school before I learned Atari Basic.

author: Smokey
author_rank: Super Contributor
timestamp: November 12, 2022, 04:44:38 am
content: I was thinking about a similar thing over the summer.It didn't end up happening, but I was leaning towards something to do with Python and Minecraft to relate it to something they are already excited about. The Minecraft resources are ok, but I feel like it makes the basics of programming ideas a little convoluted since you need to interact with libraries from the beginning.I wasn't sure how well a command line python interpreter by itself would keep their interest to get through the whole "what is a variable, what is a for loop" type core lessons.

author: fourfathom
author_rank: Super Contributor
timestamp: November 12, 2022, 05:38:09 am
content: Quote from: eti on November 12, 2022, 12:03:43 amWow, eti, who pissed in your cornflakes?I can't tell if your "sterile, toxic and egotistical" pejorative is directed at me, or software in general, or something else, so before I take offence I'm going to ask you nicely if you would care to explain this in more detail.I'm not trying to turn my ten-tear-old grandson into a programmer, or an engineer -- that would be stupid and cruel. I just wanted to give him the opportunity to learn a little more about logic and numbers than he is currently getting in school. BASIC came to mind because I remember learning this simple, linear, essentially english-language, programming language and thought it might be an accessible way to familiarize a young boy with concepts such as IF, THEN, ELSE (FOR/NEXT can come later), and give him the chance to explore elementary-school math in a fun way. If he wants to go further that's great, but that's up to him.I currently design RF and digital gear, use Verilog, and code in C and C#. There is no way I would try to teach my grandson that stuff at his age.

author: eti
author_rank: Super Contributor
timestamp: November 12, 2022, 05:46:05 am
content: Quote from: fourfathom on November 12, 2022, 05:38:09 amI’ve had a terrible day. I’m sorry. Take care.

author: BrianHG
author_rank: Super Contributor
timestamp: November 12, 2022, 06:26:03 am
content: Quote from: fourfathom on November 12, 2022, 05:38:09 amThis might be perfect for you:https://www.quitebasic.com/Real-time online interpreter with program stepping to run a line at a time.Sample basic programs included, simple enough for 10 year old beginners.Nothing to download, 100% runs in your browser.Even does simple graphics.

author: _Wim_
author_rank: Super Contributor
timestamp: November 12, 2022, 06:29:42 am
content: Quote from: sokoloff on November 12, 2022, 01:18:50 amMaybe not directly scratch as a language itself, but Lego Mindstorms is programmed with scratch:https://education.lego.com/en-us/product-resources/mindstorms-ev3/teacher-resources/scratch-how-to-videos

author: Infraviolet
author_rank: Super Contributor
timestamp: November 12, 2022, 06:56:37 pm
content: I recall a website called "learn python the hard way" which, for the first few sections, before fancy object-oriented stuff started to be discussed, gave a very good introduction to common programming structures and universal functionality (shared between almost all langugages)....But programming with an arduino, and therefore being able to have a program reading real sensors and running real actuators is a lot more rewarding for a beginner than writing programs which just do things on a screen.

author: DavidAlfa
author_rank: Super Contributor
timestamp: November 12, 2022, 07:57:37 pm
content: Didn't Lego made some sort of programmable stuff?Would be great for him to program something he can actually see and play with.

author: Smokey
author_rank: Super Contributor
timestamp: November 13, 2022, 03:05:16 am
content: Quote from: DavidAlfa on November 12, 2022, 07:57:37 pmThey are discontinuing the Mindstorms stuff, but I guess they have a new option:https://www.theverge.com/2019/4/2/18292326/lego-spike-prime-programming-bricks-scratch-technic-roboticsQuote from: DavidAlfa on November 12, 2022, 07:57:37 pmIsn't that essentially why we all got into embedded systems and not pure computer science?

author: Picuino
author_rank: Super Contributor
timestamp: November 13, 2022, 02:05:26 pm
content: For a 10 year old who is just starting out:Code.org:https://code.org/Guided challenges to start programming in a gamified wayScratch:https://scratch.mit.edu/projects/editor/MIT's big bet to teach programming to children. The language is ranked 21th in popularity of all languages according to the TIOBE index.Makey Makey:https://makeymakey.com/Very simple board to start with physical computing in a fun way.micro:bit:https://makecode.microbit.orgAnother physical board.Both boards, Makey Makey and micro:bit, can be programmed from Scratch.Edit:https://appinventor.mit.edu/Another development environment to create applications for mobile devices.

author: tooki
author_rank: Super Contributor
timestamp: November 13, 2022, 04:37:31 pm
content: Quote from: eti on November 12, 2022, 05:46:05 amThat’s an explanation, but no excuse. I say this truly with no malice: you really need to take a step back and figure out a way to stop yourself from posting when you’re in a mood. You’re too reactive and impulsive in that state.

author: tooki
author_rank: Super Contributor
timestamp: November 13, 2022, 04:41:09 pm
content: Quote from: fourfathom on November 11, 2022, 08:54:01 pmHonestly, why not an Arduino kit? I think being able to control hardware (like lights, displays, motors, etc) makes programming fun (more so than doing math), and it’s really not hard. There are lots of kid-oriented Arduino tutorials, both text and video.

author: Picuino
author_rank: Super Contributor
timestamp: November 13, 2022, 06:24:27 pm
content: Quote from: tooki on November 13, 2022, 04:41:09 pmBecause programming an Arduino is too complex for a normal 10-year-old.For these ages there are already adapted, simpler "development boards", such as Makey Makey.

author: NiHaoMike
author_rank: Super Contributor
timestamp: November 13, 2022, 07:44:34 pm
content: Quote from: Picuino on November 13, 2022, 06:24:27 pmIf Arduino existed back then, I'm pretty sure I could figure it out at that age.

author: Picuino
author_rank: Super Contributor
timestamp: November 13, 2022, 07:59:07 pm
content: Sure. 1% can do so.Quote from: Picuino on November 13, 2022, 06:24:27 pm

author: fourfathom
author_rank: Super Contributor
timestamp: November 13, 2022, 08:53:31 pm
content: Quote from: Picuino on November 13, 2022, 07:59:07 pmAnd I'm sure my grandson could figure it out *IF HE REALLY WANTED TO* But, he doesn't, at least not yet. He doesn't even want to build a robot, not yet. That's why I'm looking for something with a very low barrier to entry, and perhaps he will be able to do something interesting enough at first that it will motivate him to push ahead. Or at least show him that "programming" isn't beyond his reach.I do like the idea of the LEGO and other hardware approaches, and will look into those suggestions. I would prefer that the underlying "X = X + 1" stuff not be hidden underneath too many layers of abstraction, but if it takes abstraction to make it interesting then I suppose that's a good way to get started.

author: Picuino
author_rank: Super Contributor
timestamp: November 13, 2022, 09:21:19 pm
content: Try this to begin:https://studio.code.org/s/course2

author: tooki
author_rank: Super Contributor
timestamp: November 14, 2022, 08:16:24 am
content: Quote from: Picuino on November 13, 2022, 06:24:27 pmI really don’t think it is. Many, many, many people got into programming at younger than age 10, many into serious programming. Will every kid take to it? Of course not. But neither do many adults.

author: sokoloff
author_rank: Super Contributor
timestamp: November 14, 2022, 10:32:14 am
content: I don’t think c++ is an ideal first language for a 10 year-old. It’s too easy to make a mistake in syntax and get a fairly unhelpful error message from the compiler. (Plus the Arduino IDE isn’t very helpful in general.)If you have an experienced programmer to guide you, it’s totally doable, but if you don’t, it’s easy to get frustrated.Languages with a REPL or at least without a distinct compile-link stage (slight hand wave here) are often easier for beginners to pick up.

author: tooki
author_rank: Super Contributor
timestamp: November 14, 2022, 11:12:51 am
content: Quote from: sokoloff on November 14, 2022, 10:32:14 amBut isn’t that exactly the situation here?

author: Fred27
author_rank: Unknown
timestamp: November 14, 2022, 11:29:33 am
content: I'd definitely recommend something visual like Scratch. I think the key is to find what sort of coding interests your kid in particular.For instance, my boys loved creating video games withMake Code Arcade. I pormised to create a Pi-based physical arcade for them if they wrote an original game. I know that a friend's daughters were more interested in making a little cartoon in Scratch. (My boys weren't.) As someone else mentioned, Lego Boost / Wedo 2.0 / Spike Prime may be their thing. There's also a raspberry Pi hat to interface with it too. Unfortunately Lego can't seem to keep to one product range and they're all subtly different.

author: sokoloff
author_rank: Super Contributor
timestamp: November 14, 2022, 01:15:46 pm
content: Quote from: tooki on November 14, 2022, 11:12:51 amIf OP lives with their grandson full-time, yes. I didn’t find that in evidence, so suggested a course that would allow the child tomake progress as their interests drive them rather than only as grandpa visits.

author: fourfathom
author_rank: Super Contributor
timestamp: November 14, 2022, 05:03:33 pm
content: Quote from: sokoloff on November 14, 2022, 01:15:46 pmYes, that's pretty much correct. I spend a lot of time with my grandson (we're best buddies), but there are big gaps. I would like to find something that grabs his interest, but I will be satisfied if he just learns enough to not be intimidated by it all as he grows up.Again, I appreciate all the discussion here.

author: rdl
author_rank: Super Contributor
timestamp: November 14, 2022, 06:53:40 pm
content: You might consider Parallax. They're not cheap and wouldn't be of interest to most people here. But, their primary focus is education and the quality of what they produce is excellent. Your grandson is right at the lower end of their age recommendations.https://learn.parallax.com/tutorials/grade/grades-5-8

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 25, 2022, 04:35:16 pm
content: Pileofstuff reviewed the CrowBot Bolt - Open Source Programmable Smart Robot Car kit:and it seems to be very nice, open source programmable, and not too pricy ($60 or so with the joystick, both joystick and robot having ESP32's and are user-programmable).I am only slightly ashamed to admit this looks like something I might enjoy, and am considering getting just for myself.

author: artag
author_rank: Super Contributor
timestamp: November 25, 2022, 05:32:33 pm
content: Quote from: fourfathom on November 13, 2022, 08:53:31 pmI think that's key. Some people love programming for it's own sake, but I think most of us got into it because it was a tool to do what we wanted to do. He'll learn to do anything if he sees it as a way to realise his imagination.So, start with what he loves. If that's only playing games it's much the same as watching television. But if he's dissatisfied with what he has and wants more - different gameplay, or characters, or better interaction - then programming or electronics is a path he might try.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 25, 2022, 06:22:03 pm
content: Quote from: artag on November 25, 2022, 05:32:33 pmI agree, that's why I thought the above kit might suit fourfathom's grandson: it is easy enough to put together (no soldering or anything, see the video), and you can use the wireless "joystick" (more like a gamepad) to drive the robot around too, with ready-made programs for other stuff. No need to learn to program, if one does not want to.What I like about this kit, is that it is open source. Not only the software, but also the schematics and Eagle files are available. This is the way STEM toys should be done.

author: gamalot
author_rank: Super Contributor
timestamp: November 25, 2022, 06:44:14 pm
content: Children are smarter than people think! Half a year ago, I taught my son how to use Python to control character movement and build simple patterns in Minecraft Education Edition, and he understood it easily. A few days ago, I taught him how to solve linear equations in three variables. After I explained it to him once, he could do it by himself. In 40 days, he will be 10 years old, and I will start teaching him programming, starting with Python.

author: Zero999
author_rank: Super Contributor
timestamp: November 25, 2022, 07:11:44 pm
content: I started programming with QBasic, which of course many remember was shipped with MS-DOS.I've played with FreeBASIC which works quite well.Another option is QB64, which I've not tried, but is supposed to be very close to the original QBasic.https://qb64.com/

author: Cyberdragon
author_rank: Super Contributor
timestamp: November 25, 2022, 07:44:04 pm
content: Quote from: Smokey on November 13, 2022, 03:05:16 amThey canned it since the new one was kinda meh and it's all online based. The software for older systems can still be found though, everything from RCX to EV3. If you want to get the new systems running on their own without Lego, usehttps://pybricks.com/

author: RJSV
author_rank: Super Contributor
timestamp: November 25, 2022, 09:44:58 pm
content: Try an approach, like an airplane flying lesson.Kid sits a little back, while you go through a whole pile of install, activate, etc. But not for too long.Then, you switch seats, have him enter something simple, like printf "My name is 'xxxx", maybe 3 times.Then, a simple 'If Then', and build up from there.That way you aren't teaching, immediately, the whole operating system, file system etc. Basically you would be letting more and more control (programming) be learned. Explain to kid, the operating system is a kind of environment, like a little village, explain he has to gradually learn, not just programming itself, but all the capability (he) needs to navigate the system.And explicitly explain, the system is a lot to learn also, gradually, warning not to feel overwhelmed, by complexity, but that he has to develop focus, in things like program creation.You guys can always switch seats, when you need to take the reins, when some compiler error gets in.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 25, 2022, 11:31:01 pm
content: For Python, I warmly recommend starting early with PySDL2 and/or Qt5 (PyQt5 or PySide2), and using Inkscape to create all graphics in the SVG (Scalable Vector Graphics) format, saving originals in Inkscape SVG format, and "finals" using Optimized SVG. The former retains your Inkscape guides and such, but the latter optimizes the SVG for parsers, also shrinking the file size. SVG images are fully scalable, support transparency, and even gradient fills. You can also use any browser to view SVG files.The reason for this is that you can do real games and applications this way, and have them look as professional as you can. There are no limitations. Even if you decide you go to high-performance graphics via OpenGL, that works too; there are display widgets for that as well.The one annoying thing with Inkscape is that when you do computer graphics with it, you need to do a three-step Document Setup in the beginning.First, inFile>Document Properties, you need to setDisplay Units: pxandUnits: px,Scale: 1,Checkerboard Background, andWidth:andHeight:to the desired size in pixels. This way, allpxmeasurement units in the SVG file are in native SVG units, and you get the best results overall (no DPI issues et cetera; these work just fine even on HiDPI displays). See attachedinkscape-1-pixel-mode.png.Because Inkscape chose the right-hand coordinate system with origin at bottom left corner, changing document properties will always introduce an annoying translation to the SVG coordinates, even when the canvas is empty. To fix that, inEdit>XML Editor, select theid="layer1"element on the left, and then thetransformon the right. Delete it using theDelete Attributebutton top right, and close that window. See attachedinkscape-2-fix-transform.png.Modifying any of the layers inXML Editorcauses Inkscape to drop to canvasroot"layer". You don't want to draw there, you want to switch toLayer 1, because Inkscape uses the SVGglayers to do its internal markup and such. The selection is at the bottom left/center of the window; just click where it reads(root)and pickLayer 1. See attachedinkscape-3-select-layer.png.In Python, you can load SVG files asQPixmapobjects, which are optimized for display on-screen. You can use a QPixmap inQLabelsinstead of text, inQGraphicsScenes, even inQPictures if you want to create a drawing application of some sort.Of course, there are Python modules and libraries that make it even easier to create games, but this is the "real world" complexity level when creating user interfaces and applications in Python. AsPySDL2 documentationshows, it is much more oriented towards game development, and has its own internal approach and model as to how game mechanics (sprites, et cetera) should be constructed.However, both firmly use event-based programming model, the main difference being that with SDL2 the programmer is in control of the event loop, whereas in Qt5 (and basically in all windowing toolkits like Gtk, FLTK, etc.) the toolkit is in charge, and you just write the code responding to the events.To additionally interface to microcontrollers, I recommend using a separate Python thread (or two); or a separate process, if there is a significant amount of data (more than full-speed USB, 12 Mbit/s) or processing (like FFTs or such) involved.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 26, 2022, 12:07:24 am
content: An aside, since it WILL come up with anyone teaching kids to manipulate sprite-like images:Qt and other widget toolkits cannot detect when partially transparent SVG or PNG images overlap. The solution for that is to subclass QPixmap (or whatever widget you use to represent stuff on-screen, often QLabels or QGraphicsItem), and addhitboxsupport. One can then check if they overlap or intersect, by checking if their hitboxes intersect. In most cases, hitboxes are either axis-aligned rectangles, or circles, defined in the SVG or PNG (pixel) coordinates (important!). It is simplest to use either rectangles OR circles, because rectangle-rectangle and circle-circle intersections are trivial, but rectangle-circle intersection is a bit tricky, especially if the rectangle is large compared to the circle. However, Qt also providesQPolygonorQPolygonFclasses with.intersects()method, that will tell you if two polygons intersect. If you define their coordinates in the SVG or PNG pixel units, that gives very detailed hitboxes. On the other hand, (collections of) circular hitboxes can also do directional reflections, which is neat if you have e.g. a bulletproof character and want the bullets to just ping off.One good approach to create sprite-like animated objects in Python is to use Python's built-inconfigparserto describe the images (animation) and hitboxes in a plain text INI-type file. Create a library class, initialized by specifying the path to an ini file, and have it load the images and information, and create a library of the aforementioned subclassed widgets. The library itself only needs a simplelist()andget(name)interface. Depending on the game, you can add structure to the library, for example each character direction having their own animations, et cetera.

author: Smokey
author_rank: Super Contributor
timestamp: November 26, 2022, 04:19:41 am
content: Quote from: Nominal Animal on November 25, 2022, 11:31:01 pmGUI developers are the least happy of all software people. If you aren't going to stick to embedded systems, at least teach the kids how to be a back end developer. No GUI required(I'm kidding... sort of...)

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 26, 2022, 05:44:40 am
content: Sure, but you're not going to spark a today's kid's imagination with "Hello world". You need something more visual, or that has somehow some other impact.Having the computer print "Hello, Smokey" on the screen is as interesting to them as us typing the same on a typewriter would have been.Fun for maybe thirty seconds, but that's it. After that, it'd be only interesting if one is interested in the typography; and today's kids quite fast find the knobs to switch the font on the terminal...I think of it as the "This is the real deal, kiddo" -approach. Show that imagination is the only limit. And then let the kid lead where their imagination and motivation takes them, just being the mentor and helper along the way. Just my opinion, though.

author: tooki
author_rank: Super Contributor
timestamp: November 26, 2022, 11:00:17 pm
content: That’s why I suggested Arduino, since you can make lights blink and motors spin and stuff like that.

author: SiliconWizard
author_rank: Super Contributor
timestamp: November 26, 2022, 11:04:41 pm
content: I would suggest you exposed the kid to Rust.

author: Nominal Animal
author_rank: Super Contributor
timestamp: November 26, 2022, 11:26:01 pm
content: Quote from: tooki on November 26, 2022, 11:00:17 pmAnd why I suggestedCrowBot Bolt by elecrow in #41, and actually ordered one for myself.I did a group buy with a friend: he got one for his twin boys (ten, IIRC), and me one for myself.I refuse to grow too old to play, even if society tries to make me be ashamed for it!I have been thinking about such remote-controllable vehicles, but with (adding!) a circular optical sensor (either rotating, or an array) on the bottom. The idea is that before the kids can program, they can use a whiteboard on the ground, draw a maze (using dark lines as allowed paths), and compete in who solves each one first. If you use a dedicated whiteboard, you can even add belts and small linear rails on one axis, and a second axis and a servo for a whiteboard pen, for drawing them under computer control.If it comes to anything, the next step would be a much smaller vehicle with just a ground-facing camera module at very low resolution. There are optical mouse sensors with perfect resolution for my needs, and I only need to scan the perimeter pixels (and let the mouse sensor do optical flow otherwise), but the ones I could find (other than in specific used optical mice models) are quite expensive. For example, for wheels, I'd use these tiny (8mm×6mm) stepper motors instead of DC gear motors. Say, matchbox-sized, or only slightly larger.It wouldn't then be a big step to replace the remote controller joystick –– which in the Bolt case is open-source programmable and uses ESP32 –– with ones own maze-solving code.Fun times ahead, even if it yields no useful results.

author: RJSV
author_rank: Super Contributor
timestamp: December 03, 2022, 12:36:02 am
content: A tiny bit of hardware device knowledge won't hurt.Included here, photo shows a FLIP-FLOP bistable circle of ten inverting light sensing switches. (You have seen, elsewhere, on the FORUM.Two gates in a circle can form a latching element, on or off, but alas...the light beam won't bend, no matter how hard I pushed, (lol). Tried moving really, really FAST, but the beam was 'gone' before I could swivel the little garden light.No effort learning, and nothing to short out. That's how 'The Coding' should be.Ten or twelve, is good, as even number around. It's easier to switch the FLIP-FLOP logic using a dark thick business card, blocking whichever 'state' is ON.A tight beam flash torch or laser pointer works too, in opposite logic polarity.Hardware stores generally charge way too much, $7 and up, each. I used local thrift 'dollar' store, got 60 of them, at buck 25 each, on a flat (boxed mass set).

author: RJSV
author_rank: Super Contributor
timestamp: December 03, 2022, 12:48:43 am
content: LOL,. others in house are on ZOOM...No bandwidth left to send my photo...it just hangs, lingering on the post, but text makes it in.

author: RJSV
author_rank: Super Contributor
timestamp: December 03, 2022, 01:00:26 am
content: Photo.

author: Nominal Animal
author_rank: Super Contributor
timestamp: December 03, 2022, 01:05:33 am
content: A local company here sells cheap IR photoreflectors (since I will be reading "down", close to the surface, whether surface is white/reflective or dark/absorptive) in SMD; I could get 100 of them for 10€. I basically want enough of them to detect which directions the bot is allowed to go.Mouser has Sharp GP2S60 series photoreflectors in stock, for less than 6€ for 10.For a custom bot, a surface-facing camera, say a cheap OV2640 with a wide angle lens, could be used to "read" markings/instructions drawn on the surface. I'm surprised nobody has made such a toy yet, especially since interfacing an OV2640 to an ESP32 is a commonly done thing, and you can get the modules for literally under five euros/dollars. It would of course need to be central to the bot, to be really useful, so the bot chassis would need to have a rather large hole in the middle for the camera.