Arduino Coding Issue...figured I'd ask my peer here first

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.


xl97

Master Member
How you arrange your LEDS is up to you..

They dont need to be in a 'square' pattern/physical arrangement..

I used them (initially) for my TRON disc... I arranged them in a single 'line'... and you can as many or as few as you need 'on'..

A PCB? depends on your final use... you can buy them already on break out boards... or get the 'bread-board friendly' version (DIP)

Perhaps look at using Neopixels then... note: the current need will be MUCH more than using a MAX chip.. but you multi-colors if going the Neopixel route..
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

jamstraz

Active Member
Multiple colors on one model, but not in one place. For an example I will use the K't'inga model. In the head I will have 1 white led, 1 red and then another red to run the routine you helped me with. In the neck are two LEDs which blink, in the body two white for fiber runs and then two red for impulse engines and another red for torp. Colors are constant. That makes 10 LEDs. 3 white, 7 reds.

So two are off until buttons are pressed, 2 blink, and 6 are on. What I want to do with the blinking and other 6 is like a power up sequence to be on and then a flickering "damage" button which simulates being hit ala Star trek where lights flicker on the outside of the ship when damaged
 

jamstraz

Active Member
The power up I can do modifying the torp sequence but flickering random code plus having those LEDs on might be an issue. Especially if I end up needing more LEDs than I'm estimating. I know on my Romulan warbird I'm looking at 8 for both nacelles alone.
 

xl97

Master Member
I dont know (and not to be rude, dont care) about the specific models you use.. thats up to you.

This is just common/factual knowledge... you can use it as you see fit.. and where you see fit.


MAX7219:



As far as Neopixels go..

They are ALL individually addressable.

They are all 'RGB' (or RGBW even.. which is what I could suggest for you if you go the Neopixel route)

Any led can be on or off.. any led can be any shade of color you want.

HOW you code it is up to you.... but you dont see to have an interest in learning.. just having someone 'do it' for you..

Maybe post it a side/commissioned job or something?
 

jamstraz

Active Member
I dont know (and not to be rude, dont care) about the specific models you use.. thats up to you.

This is just common/factual knowledge... you can use it as you see fit.. and where you see fit.


MAX7219:

You're misunderstanding me and I'm sorry for that. I'm only trying to understand concepts. Such as how to use that chip. But I'll try to do some research on my own. Thank you again for your help. I have learned a few things such as tweaking it to add more buttons to control the same LEDs . I won't take up anymore of your time.



As far as Neopixels go..

They are ALL individually addressable.

They are all 'RGB' (or RGBW even.. which is what I could suggest for you if you go the Neopixel route)

Any led can be on or off.. any led can be any shade of color you want.

HOW you code it is up to you.... but you dont see to have an interest in learning.. just having someone 'do it' for you..

Maybe post it a side/commissioned job or something?
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

jamstraz

Active Member
I have a comprehension issue with concepts I don't grasp. Like electronics and code and anything in higher math(algebra, Calculus). I will do more research and see if I can find some examples of it's use outside of the 8x8 matrices I've seen it in. Yes coding does genuinely give me migraines but I don't really want someone to do it for me. If that was the case I would have purchased preassembled and programmed models. I apologize for the misunderstanding. I will let this thread die. But I do thank you for your help and insight.
 

xl97

Master Member
Sorry.. hard to keep up.... as you keep posting how much you cant code.. and your 'migraines'...etc... and everytime someone offers suggestions.. you just kinda debunk it all with "you cant code"... which is what we are trying to help you with here..

understanding the basics... :)

You're misunderstanding me and I'm sorry for that. I'm only trying to understand concepts. Such as how to use that chip. But I'll try to do some research on my own. Thank you again for your help. I have learned a few things such as tweaking it to add more buttons to control the same LEDs . I won't take up anymore of your time.


"I" personally do not care about any amount of questions..... however, its nice to see someone take initiative and look up the things we suggest or tell you about... or have the stance of 'ready to learn'..

The chip itself it pretty easy to use... just follow the diagram in the link I posted..

There is a library available too.. which makes USING the chip even easier (for people like me & you!) :)
 

xl97

Master Member
The pre-assembled version are in led matrix/physical square form, by design.

Usually they are using it for scrolling text messages and stuff like that.. or low budget animations..etc..

You can arrange the LEDS in any physical order you want.

Perhaps just getting a Neopixel strip will be easier for you start off with?

just 3 wires to the LED strip..
 

jamstraz

Active Member
Maybe. I just am also trying to not add too much more money to these projects. I already have a large amount of leds . And it's a threefold issue: I am a bad coder because trying to understand, read and write code gives me the migraine that then causes me to cycle back to saying I can't code. Fact is I can with some training wheels so to speak. I understood the code I got from you to modify it into a startup routine for several LEDs going on in sequence controlled by another button. But when it comes to higher concepts sometimes I need it explained out. I remember in college being told we need to see the forest for the trees, meaning modules. I'm sadly the opposite. I need to see the trees for the forest. I see what I want it to do overall, can write it out in pseudocode such as if condition a is met, run routine a and b. If cond a is not met, run routine c. Translating that to any other language is usually where I get hung up. I see trees. Not the forest. I know there is a forest. But I'm fixated on one piece sometimes and modular programming is what we are meant to do. I can hear Dr. Vitolo telling me maybe I should switch majors because "coding isn't in you".
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Fishbowl

Well-Known Member
Maybe. I just am also trying to not add too much more money to these projects. I already have a large amount of leds . And it's a threefold issue: I am a bad coder because trying to understand, read and write code gives me the migraine that then causes me to cycle back to saying I can't code. Fact is I can with some training wheels so to speak. I understood the code I got from you to modify it into a startup routine for several LEDs going on in sequence controlled by another button. But when it comes to higher concepts sometimes I need it explained out. I remember in college being told we need to see the forest for the trees, meaning modules. I'm sadly the opposite. I need to see the trees for the forest. I see what I want it to do overall, can write it out in pseudocode such as if condition a is met, run routine a and b. If cond a is not met, run routine c. Translating that to any other language is usually where I get hung up. I see trees. Not the forest. I know there is a forest. But I'm fixated on one piece sometimes and modular programming is what we are meant to do. I can hear Dr. Vitolo telling me maybe I should switch majors because "coding isn't in you".

I've gotta be honest, I'm struggling to follow this thread, but here's my 2 cents (because I am a software developer):

It seems like you have a clear idea in your head of what you want for each of your models. That's great! It gives you something to aim for! But if you're starting from a position of not being a software engineer, then any amount of doing it from scratch is, unfortunately, going to be a huge challenge.

It's no different to learning any skill. Just because programming is done on a computer and there's a literal world of resources out there online doesn't make doing it any more trivial. You need to break down what you want your end goal to be into managable steps, and tackle each one at a time.

OK so real-world example. In spite of having been a developer for over a decade, I've never used an arduino, and I haven't touched microelectronics since about 2003. I bought a basic Arduino starter kit this weekend because I'm working on my first ever lighted model. Here's how I've tackled it:

0. Watch about 4 hours of Youtube on how to do basic stuff with LEDs and arduinos. From that, I found out about tinkercad.com/circuits.
1. Use Tinkercad to build a super-simple circuit, using the components I would physically use (Arduino Uno, breadboard, LEDs, Resistors)
2. Read up on Ohm's law and get that sorted in my head so I don't blow all my LEDs up.
3. Download the Arduino IDE and read all of the instructions.
4. Copy my tinkercad circuit onto a breadboard (literally 1 LED, 1 220Ohm resistor, and 3 leads.
5. Plug in the Arduino and light up my first ever LED!
6. Write my first function which flashes the LED
7. Keep expanding my code to fit more scenarios I need.

See how I got to step 5 before I'd even lit a single LED? From reading what you've written, it honestly sounds like you're trying to do everything at once and build a complex state-machine with conditional loops for various effects. If you want to do that, and you don't want to start from the point of lighting up a single LED, then a few more, etc etc, I seriously suggest asking someone to write that code for you, comment it up well, and then you can read it to understand it, because otherwise that's the fastest way to get into a mess, and in this situation, a mess either results in you being frustrated, not finishing a project, or worse, you do it wrong, finish it, and then have to pull your model apart because something isn't right.
 

xl97

Master Member
I suggest (if not getting one of those beginners kits)... go through ALL the examples in the IDE..

and find a site, and follow their 'tutorials' to build upon your exposure and knowledge.

I always thought these sites were nice.. and build upon previous tutorial knowledge...


 

jamstraz

Active Member
ok I've gone through a mess of things and it looks like I might be fine with a single Arduino UNO (knockoff) per model with screw shields. "With 6 analog and 14 digital pins , you can connect 20 LEDs to a Uno. For more than that , you have to multiplex the LEDs or use an addressable LED strip.
Be sure to add a resistor between the Arduino Uno and the LED since the Uno has a 5 V output."

I won't be exceeding 15 LEDs
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Fishbowl

Well-Known Member
ok I've gone through a mess of things and it looks like I might be fine with a single Arduino UNO (knockoff) per model with screw shields. "With 6 analog and 14 digital pins , you can connect 20 LEDs to a Uno. For more than that , you have to multiplex the LEDs or use an addressable LED strip.
Be sure to add a resistor between the Arduino Uno and the LED since the Uno has a 5 V output."

I won't be exceeding 15 LEDs

Yep, so you need attach your LED groups in serial, and then pick a numbered pin as the power, and another as the ground (set the pin to pinMode(<PIN_NUMBER>, LOW) to use as GND). For almost all LEDs, you can use a 220 or 330Ohm resistor at the beginning of the chain. Then you can program each pin you are using.

Also, any specific reason why are you using screw shields? Are you not doing any soldering? If you breadboard the circuit out beforehand you can eliminate any uncertainty before you solder.
 

jamstraz

Active Member
Yep, so you need attach your LED groups in serial, and then pick a numbered pin as the power, and another as the ground (set the pin to pinMode(<PIN_NUMBER>, LOW) to use as GND). For almost all LEDs, you can use a 220 or 330Ohm resistor at the beginning of the chain. Then you can program each pin you are using.

Also, any specific reason why are you using screw shields? Are you not doing any soldering? If you breadboard the circuit out beforehand you can eliminate any uncertainty before you solder.
The screw shields are because I'm planning on using cheap uno clones from China for each model. At $3.16, they are cheap enough for me to not need to program a chip.
 

xl97

Master Member
?

That answer has nothing to do with the question(s)..


Are the UNO clones you are buying HAVE screw terminals built into it or something? (what does that have to do with programming....anything?)


Also.. Any given Arduino pin can ONLY provide roughly up to 40mA (max)...

Usually an accent LED fully only takes roughly 20mA..... depending on the LED and color.. you can maybe get away with limiting it (with resistors) to like 5mA per led.. thats still ONLY 4 LEDS per pin..
 

jamstraz

Active Member
?

That answer has nothing to do with the question(s)..


Are the UNO clones you are buying HAVE screw terminals built into it or something? (what does that have to do with programming....anything?)


Also.. Any given Arduino pin can ONLY provide roughly up to 40mA (max)...

Usually an accent LED fully only takes roughly 20mA..... depending on the LED and color.. you can maybe get away with limiting it (with resistors) to like 5mA per led.. thats still ONLY 4 LEDS per pin..
At this point it has nothing to do with programming. Fishbowl asked why I'm using shields. I'm stating per model there is one Arduino Uno clone which are $3.16 or so apiece. I am thinking of using screw shields to utilize the sockets. The LEDs will be soldered to respective wires and then screwed into the shield to use the pins. There will be no more than 15 LEDs per model tops. Most will be 8 or less.
 

rworne

Jr Member
At this point it has nothing to do with programming. Fishbowl asked why I'm using shields. I'm stating per model there is one Arduino Uno clone which are $3.16 or so apiece. I am thinking of using screw shields to utilize the sockets. The LEDs will be soldered to respective wires and then screwed into the shield to use the pins. There will be no more than 15 LEDs per model tops. Most will be 8 or less.

Just as a suggestion, I'd look at the Pro Micro. Same price, better (small) form factor, USB support is built in,
No need for a shield, just use one for prototyping on a breadboard then solder directly to another board once you are happy with your wired prototype. Just be sure to order the correct voltage for your application (3.3V or 5V).

s-l225.jpg

Only reason I suggest these is because it's so easy to cram it into whatever space you have as it is less than 25% the footprint of an Arduino UNO.
 

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Don't want to see this ad? Sign up for anRPF Premium Membershiptoday. Support the community. Stop the ads.

Top