Personal Coding Project

Hello everyone,

I am currently creating an Arduino circuit that heavily involves programming. I don't have much background in coding except for a C++ class I took a few years ago and haven't really coded since. I was hoping for some help being pushed in the right direction.

Project:
The Arduino circuit I am creating has 5 buttons, with roughly 30 different variations (I know that 5!== 120, but I am using all combinations). Each button turns on an individual light. I started writing my code with the basic if/else statements, where the program determines which variation it is, then sends that to a switch statement which ends in turning the lights on.

My questions are:
Is there a better way to get the input from the user? If so, could you elaborate?
Would it be better to use a balanced BST instead of a switch statement?

I don't have much experience in writing BST's, but I know the gist of them and there are plenty of sources where I can learn about them on this website. Also, I was thinking of maybe overloading functions with 1,2,3,4, and 5 permutations, but I don't really know how I would do that either.

Oh, one last thing. I hate coding in arduino, and I currently have windows. Can anyone recommend a better text editor and compiler? Like I said, it's been a while since I've been around coding.

Thank you in advance for your replies!
Visual Studio or code::blocks I prefer Visual Studio. Sorry can't help you with your code problem.
closed account (48T7M4Gy)
What is a BST in relation to an Arduino? If you mean a binary search tree you are probably looking in the wrong direction. You'll run out of memory.

Assuming the button can only have 2 possible states then you have 2^5 possibilities. You can take advantage of that and just switch on the basis of the binary value with a couple of lines. Do a search on the numerous dedicated Arduino forums. There are many. Here's one picked right off the top of a Google search.
http://www.instructables.com/id/Controlling-20-Leds-from-5-Arduino-pins-using-Cha/?ALLSTEPS

Always remember that an Arduino controller has very limited program and data memory. It is a device controller not a full blown computer.

There are a few add ons for programming Arduinos for Xcode, VStudio etc. After trying them out my experience is they get in the way and just add another layer of complexity without doing anything more than the Arduino system, especially if all you really want is to control a few lights or other gizmos as quickly as possible. Of course others might see the add ons differently. :)

Last edited on
Topic archived. No new replies allowed.