r/CodingForBeginners • • 4d ago

We Built a Lucky Spinner That Spins Randomly but Always Knows Where to Stop 🎯

3 Upvotes

We wanted to make a simple prize spinner with micro:bit, but there was one thing we didn't want to compromise on: the spinner could be random, but its final position had to be accurate.

So we built this four-way Lucky Spinner using a PlanetX Smart Brick Motor and parts from the ELECFREAKS Nezha Pro Sport Kit.

There are four possible results: a blue ball, a red ball, a black-and-white soccer ball, and an orange-rimmed soccer ball. Each one represents a number from 1 to 4. When the red pin at the end of the spinner arm points toward one of them, the micro:bit displays the corresponding number.

The interesting part is how the program handles the spin.

Before the first draw, we point the arm toward the blue ball and press Button B. The program saves the motor's current absolute angle as the reference position for Result 1. It doesn't matter whether the motor is physically at 0° or not. What matters is that the program now knows which direction represents the starting point.

When we press Button A, two random values are generated:

  • A result between 1 and 4.
  • A number of full rotations between 3 and 5.

The motor spins at full speed, completes the selected number of rotations, and then moves to the calculated target angle. Since the four prize positions are 90° apart, the program can work out exactly where the arm needs to stop.

For example, if the selected result is 3, the arm needs to finish 180° away from the calibrated starting position. Even if the spinner makes a different number of full rotations each time, the final direction still matches the selected result.

We also added a short delay before showing the number. Once the arm stops, the program waits 0.5 seconds and then displays the result for three seconds. After that, the number disappears and the standby icon comes back. The program temporarily ignores new button presses while a draw is in progress, so the next spin can't interrupt the current one.

I like this project because it brings together a few programming ideas in a very visible way: random numbers, motor angles, calibration, and program states. You can actually see the difference between choosing a random outcome and physically moving a mechanism to the correct position.

It's a small project, but getting the mechanical direction and the on-screen result to agree is what makes it satisfying to watch.

Would you add sound or LED effects to make the final reveal more dramatic?


r/CodingForBeginners • • 4d ago

Как начать свой путь

2 Upvotes

Привет всем, я учусь на программиста, но в колледже дают мало информации, так сказать просто базу. Но я хочу преуспеть в веб кодинге, что для этого нужно изучить? Я знаю базу HTML, CSS, c++ и питона. Но я не могу понять, что мне дальше делать


r/CodingForBeginners • • 5d ago

Confused and need guidance...😭

7 Upvotes

I'm Engineering 3rd year grad and almost wasted my time because of managing financial challenges at home... Although I did learned basic web development, and started learning python and js. Now as I don't have much time left what should I do? Should I join any paid online/offline coaching?


r/CodingForBeginners • • 5d ago

Does anyone know any learning sites for mobile for python?

6 Upvotes

I've watched some tutorials but I really don't want to spend 12 hours watching a video on how to code I really just wanna do it at my own pace any website helps!


r/CodingForBeginners • • 5d ago

Which good hackathons are open for registrations right now (apart from internal college ones)?

2 Upvotes

I’m a first-year engineering student looking to participate in my first proper hackathon—either online or offline in Bengaluru.

​Apart from the ones happening in my own college, which active hackathons on Unstop, Devfolio, or Devpost are actually worth applying to right now? Open to beginner-friendly, AI/Python, or open-innovation tracks.

​Also, any tips for a first-timer on finding teammates or picking a problem statement would be super helpful!


r/CodingForBeginners • • 5d ago

how might i do this?

1 Upvotes

coding is fun and cool for me, but i have no clue how id approach this


r/CodingForBeginners • • 6d ago

What programming books would you recommend for someone starting from scratch?

16 Upvotes

As a student learning to code, programming books are something i am looking into. I want to get the complete picture from base up, build a strong foundtion. I am particularly interested in - Programming fundamentals and computer science in general. Web development (HTML, CSS, JavaScript). Frontend and backend development. Full-stack development. Overall software development concepts and best practices.I'm open to books for complete beginners as well as ones I'll be able to grow into as I gain experience.


r/CodingForBeginners • • 5d ago

How should I learn c language?

0 Upvotes

Wanna learn c language, suggest me lectures, or any other material


r/CodingForBeginners • • 5d ago

Cant see what im running (pycharm)

Post image
0 Upvotes

I have 0 knowledge on anythong coding related and im following a tutorial (https://youtu.be/ix9cRaBkVe0?si=flrH6JpjhOJuwbTO) on which im on minute 6:52 and i cant see what im running, the green result of what i write is not there. Whats there is just some default info????


r/CodingForBeginners • • 6d ago

Need help setting up a gui library in C

2 Upvotes

I would owe the world and more to whoever helps me

Okay so hi everyone, i'm fairly new to programming and recently i challenged myself to program something in C, i wanted to make a gui calculator bcs i thought it was fairly simple.

Turns out it's not that easy, and i discovered i had to download gtk4 and learn it, and i'm willing to do that i just need some help on how to download it, set it up and link it, preferably on codeblocks, but vs is great too.


r/CodingForBeginners • • 6d ago

Coding struggles

6 Upvotes

I've struggled learning how to code ever since I was in second year and I'm currently flon course to graduate next month and I don't know what to do.


r/CodingForBeginners • • 6d ago

Has AI helped you learn programming? Looking for feedback & early testers

3 Upvotes

Hi Everyone,

I was wondering if anyone here has used AI to help them understand programming concepts? What was your experience? What worked well and what did not work so well?

A bit of a background to why I am asking this, I've tutored students for a long time (about 10 years), in various topics, including programming, and in the last couple of years, I couldn't shake out the thought of how AI could be a great tool for learning if used properly. I have experienced first hand how tutoring could change how well and deeply students could understand topics opposite to learning in a huge classroom.

I have been working on a project where I am using AI to explain concepts to students, and I am piloting with programming, that's why I am interested to understand what your experience has been with chatbots such as ChatGPT...etc. and if you've used any other tools?

In case you're interested to be one of the first few testers, comment below or send me a DM, would be happy to get your feedback and develop this to be a truly helpful tool.

Thanks,

Daniel


r/CodingForBeginners • • 7d ago

Codédex io Alternative?

3 Upvotes

Loving codedex.io for starting my web dev journey. Finished their free HTML concepts but structure and most of the parts of the course could be accessed only if you become a club member which cost a few dollars. (It's expensive on my currency). Any other alternative platform that has the same experience in codedex that is cheaper per month or free? ​


r/CodingForBeginners • • 7d ago

Best way to learn python from zero?

23 Upvotes

r/CodingForBeginners • • 7d ago

math in coding

7 Upvotes

hello everyone im about to start learning to code (python specifically) and i want to learn the math i would need for it first to make the learning process a bit easier.

any pointers would be greatly appreciated

thx for the help


r/CodingForBeginners • • 8d ago

Computer Science & Info

8 Upvotes

I wanna get into computer science, coding, programming and info basically but I don't know where to start I have yet to learn the basics and im a senior in hs. Does anyone have any resources?


r/CodingForBeginners • • 8d ago

Hi everyone! My teacher asked me to prepare a project about sorting an array using algorithms. I will have to explain the topic in front of the entire class. I want to make the presentation interesting and easy to understand, rather than just explaining the code.

4 Upvotes

r/CodingForBeginners • • 7d ago

Check out Learn to Program with Scratch : A Visual Introduction to Programming with... on eBay!

Thumbnail ebay.io
1 Upvotes

r/CodingForBeginners • • 8d ago

Interested in learning coding

7 Upvotes

Hi there! nice to meet you! Just a little back story about myself I previously posted on another thread about learning cybersecurity. I’m a mom of two and sole breadwinner of the family. I can’t afford to study a degree again and I have recently learn how to vibe code an app with help of AI. And I have started the process of learning how to code from basics currently only knowing the basics of what html/ css/ JavaScript does and simple coding. I would like to delve deeper into learning how we can actually write codes to formally build websites and apps and how codes can translate into UX/ UI tools. I want to learn how to check whether my code that was written by AI is correct and I want to learn how to debug myself as I know vibe coding is fun but I really am interested in learning and understanding the codes behind it to make it work. My plan is to master coding first before delving into cybersecurity since i learnt from the other thread it is a very broad subject to learn. Can someone point me where to start learning? What sort of coding programs should I learn python ? In order to fully develop a website or app by myself? Thank you all for reading ! Any feedback is appreciated! ☺️


r/CodingForBeginners • • 9d ago

QUICK QUESTION

5 Upvotes

is it ok to use AI for learning how to code and what do you guys think?


r/CodingForBeginners • • 9d ago

Python or Roblox lua before learning C#

4 Upvotes

About need to learn coding game dev and I guess best is c# for indie ones at least but before learning should I learn python first to learn code or syntax more?

also I heard learning roblox lua and studio might be good but not sure, honestly I picked up roblox lua because might help me since i have ADHD and this one might help since some allergy meds made it worse but I’m not sure since I dont know about coding

Honestly


r/CodingForBeginners • • 8d ago

Quick Question

1 Upvotes

How much time must spent for solve eolymp or leetcode problems


r/CodingForBeginners • • 9d ago

my first actual python thingy

1 Upvotes

its a simple magic 8 ball thingy, i made it in a hour or so. you can see its code on https://github.com/matkobanko12-rgb/idk, also is there any free game engine for python somewhat simular to godot?


r/CodingForBeginners • • 9d ago

Lexon Flip Classic

3 Upvotes

Okay, I've bought myself an alarm clock and the screen is way too bright when activated (even the dimmest setting).

Do any of you know if it be possible to access the coding files to adjust brightness levels?