• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
Maker Hacks

Maker Hacks

Ideas, news & tutorials for makers and hackers – Arduino/Raspberry Pi, 3D printing, robotics, laser cutting, and more

  • Home
  • About
  • 3D Printing
  • Laser Cutting
  • YouTube
  • Free Arduino Course
  • Recommendations
  • Contact

Day 5: Lesson 02 – Variable Type Conversions and Serial Input RGB LED

You are here: Home / 30 Days to Arduino Programming Course / 30 Days to Arduino Lessons / Day 5: Lesson 02 – Variable Type Conversions and Serial Input RGB LED

We have looked at variables a little bit but now we are getting user input as Strings, we should go a little bit more into how they can be converted from one type to another.

Common Variable Types Used in Arduino

charCharacter – A single letter, digit, etc
byteA number from 0-255
intInteger – a number from -32,768 to 32,767
floatFloating point – a large number with a decimal point
StringTextual content 

Strings can convert to integers using the built-in toInt() feature of the String object.

int nowANumber = myString.toInt();

As a demonstration, here is a sketch that accepts user input for Red, Geen and Blue values, and outputs the result as an RGB color.

  • 3D Printing
  • CNC
  • Hardware
  • Laser Cutting
  • News
  • Retro Computing
  • Software

amiga amos arduino basic programming budget buying cad cnc commodore corexy c programming creality crypto doctor who emulation esp32 esp8266 filament fpga glowforge Hacks Ideas kids lighting linux Makes making Monoprice Parts pc props prusa python raspberry pi ratrig resin Reviews robots software sounds technology tips upgrades wanhao xtool

.

Maker Hacks Blog Copyright © 2023 · All Rights Reserved · Powered by Mai Theme