Go Down

Topic: Button Programming Help (Read 1 time) previous topic - next topic

CBatty

I'm a NOOB to Arduino code, and need some help. I made a 3d printed mood lamp. The button switches between "playlists" in one sketch (titled This_sketch_works), but I don't know how to get it to work in another sketch (This_sketch_doesnt_work). Can anyone help?

PaulS

Code: [Select]
const TProgmemRGBGradientPalettePtr gGradientPalettes[] = {
  Sunset_Real_gp,
  es_rivendell_15_gp,
  es_ocean_breeze_036_gp,
  rgi_15_gp,
  retro2_16_gp,
  Analogous_1_gp,
  es_pinksplash_08_gp,
  Coral_reef_gp,
  es_ocean_breeze_068_gp,
  es_pinksplash_07_gp,
  es_vintage_01_gp,
  departure_gp,
  es_landscape_64_gp,
  es_landscape_33_gp,
  rainbowsherbet_gp,
  gr65_hult_gp,
  gr64_hult_gp,
  GMT_drywet_gp,
  ib_jul01_gp,
  es_vintage_57_gp,
  ib15_gp,
  Fuschia_7_gp,
  es_emerald_dragon_08_gp,
  lava_gp,
  fire_gp,
  Colorfull_gp,
  Magenta_Evening_gp,
  Pink_Purple_gp,
  es_autumn_19_gp,
  BlacK_Blue_Magenta_White_gp,
  BlacK_Magenta_Red_gp,
  BlacK_Red_Magenta_Yellow_gp,
  Blue_Cyan_Yellow_gp };

Just how big is that array? What Arduino are you trying to run this code on?

Where, in the code that doesn't work, do you actually read the state of the pin that the button is sewn onto?
The art of getting good answers lies in asking good questions.

CBatty

Again,  sorry for being a NOOB

I'm not clear how to answer the question about the size of the array.

Im using an arduino nano,  and I know that either sketch uses no more than 34% off the memory inn the nano.

The sketch that doesn't work with the button plays fine, one playlist after another for 10 seconds each. I just need to have it work with a button on D2 on the nano.

The sketch that does work does go thru one "playlist" info a loop until I press the button to change the playlist. I prefer three look of the other sketch.

CBatty

Sorry for grammar / spelling errors as I replied on my cell phone which tried to autocorrect things

PaulS

Quote
I just need to have it work with a button on D2 on the nano.
Using wishful thinking? Or having the code actually read the state of the pin?

Work how? What should pressing the "button" actually do?
The art of getting good answers lies in asking good questions.

CBatty

@PaulS   Let's consider each "look" name as a song (like on a CD):
  Sunset_Real_gp,
  es_rivendell_15_gp,
  es_ocean_breeze_036_gp,
  rgi_15_gp,
  retro2_16_gp,
  Analogous_1_gp,
  es_pinksplash_08_gp,
  Coral_reef_gp,
  es_ocean_breeze_068_gp,.....etc.....etc.

I want one "song" to constantly "play" or loop, until the tactile button connected to the D2 pin on my Arduino Nano changes to the next "song" which would loop until I press the tactile button.

I am looking to get some help from someone that can write the necessary code in the sketch that doesn't work to work......I mean function just like the sketch that does function properly (the "look" loops until a button press to go to the next "look" on the list.

PaulS

Quote
I mean function just like the sketch that does function properly (the "look" loops until a button press to go to the next "look" on the list.
Do you understand what part of the code that works reads the state of the switch pin?
The art of getting good answers lies in asking good questions.

CBatty

I don't know much about code..... as im just starting to tinker with the arduino.  I'm clueless where to put code for the button state or action in the sketch.

I just know the button functions like I want it to in the code titled this _ sketch _ works. ino.

I've tried to copy and paste from one sketch to another but the sketch i really want to use doesn't act the way it should..... where the sketch acts as if there is no button. The look does not loop when I  press the button.

zwieblum

Where have the times gone, when people actually cared to look for an answer themselfs before asking the sombody else to solve their problem?

CBatty

Where have the times gone, when people actually cared to look for an answer themselfs before asking the sombody else to solve their problem?
@ zwieblum

I just want to make sure I'm in the "Gigs and Collaborations" part of the forum????? I'm very certain I am.

I saw the by-line reading "Are you making a project and need people to help out, calls for projects for exhibitions, fairies"

I've also read the "sticky" from Nick Gammon....and I'll paraphrase a bit by saying that I have looked around the internet for answers before posting a need for help. I'm asking for some help. I'm not 100% clear on what I'm doing and want to learn how to do what I'm asking....not just have someone do the work for me.

This is an open source type of platform where others can help people out right??? open source=help others

@ zwieblum I feel that your post was negative and inappropriate.....especially for this particular forum.

wvmarle

I just want to make sure I'm in the "Gigs and Collaborations" part of the forum????? I'm very certain I am.
Yes - this is the forum for those seeking PAID help - someone to do their work for them. Which can range from writing a particular piece of code to implementing and building a complete project. You don't seem to be looking for that, but rather looking for general help.

It's indeed sometimes confused with the "project guidance" forum, which is for general help with projects. When asking for general help you ARE expected to do your own homework, which includes going through the well documented code/project examples so at least you know basics as how to read a button.

Quality of answers is related to the quality of questions. Good questions will get good answers. Useless answers are a sign of a poor question.

Go Up