30 Days Lost in Space → Help Center
Coding Concepts — 30 Days Lost in Space Help Center
Component guides, wiring references, code explanations and fixes for the errors people hit most in 30 Days Lost in Space.
Coding Concepts
Programming fundamentals: variables, loops, functions, and logic
- Arduino map() Function: How to Scale Values — map(value, fromLow, fromHigh, toLow, toHigh) rescales a number, like a 0 to 1023 reading into 0 to 255. The formula, integer math, constrain() and examples.
- Arrays — Store multiple values in a single variable. Arrays are essential for managing groups of LEDs, sensor readings, melodies, and sequences.
- Bits, Bytes, and Bitwise Operations — Binary makes more sense once you see it as light switches. This is your guide to binary counting, bitwise operators, hex notation, and the practical patterns…
- Debouncing Buttons — When you press a button once and your code registers it five times, that is bounce. Here is what causes it physically, what it looks like in your Serial…
- Functions — Organize your code into reusable blocks. Functions make programs easier to read, debug, and maintain.
- If/Else: Conditional Logic — Make your board make decisions. If/else statements let your code choose different actions based on sensor readings and button presses.
- Loops: for and while — Repeat actions automatically. For loops count through sequences, while loops run until a condition changes. Essential for animations and scanning.
- State Machines — Your Arduino project needs to be in a mode, like locked vs unlocked or waiting vs entering a code.
- Variables & Data Types — How to store and work with data in Arduino. Learn about int, float, bool, char, and String, the building blocks of every program.
- Working with Strings on Displays — Getting numbers and text to show up correctly on your OLED or 7-segment display. How to convert variables to text, add leading zeros, format sensor readings…
- constrain() — Keeps a number within a range by clamping it. Too low becomes the minimum, too high becomes the maximum.
- millis(): Non-Blocking Timing — Replace delay() with millis() for responsive programs. Learn to run multiple tasks simultaneously without freezing your board.
- randomSeed() and random() in Arduino Code — Without randomSeed(), random() repeats the same numbers after every reset. How seeding works, seeds that silently fail, the excluded max and tested sketches.
- switch/case Statements — When your code needs to handle a bunch of specific values, like which switch position is active or which key was pressed, switch/case keeps things readable…
- tone() and noTone() in Arduino Code — tone(pin, frequency) plays a note on a buzzer and returns at once; noTone(pin) stops it. Melodies, one tone at a time, the Timer2 conflict, tested sketches.