Show Posts
Pages: [1] 2 3 ... 54
1  Using Arduino / Programming Questions / Re: Two sketches. One works, one doesn't. on: September 13, 2014, 06:25:09 pm
The full sketches are at the top of the thread.

Though I included one twice by mistake.


I am trying to work it out myself, but am running into "invisible" road blocks, like array size problems.
I have got rid of that problem by removing one of the arrays.  Now I have to work out how to put the "numbers" on the face of the clock.

But that aside, I am confused why when I   OR  the three arrays together sometimes it does, and sometimes it doesn't blend the colours.

Also when the minute ticks over and moves to the next LED, sometimes it "leaves behind" an LED turned on.   Sometimes not.

I thought that writing the entire strip to 0x000000 before I do the OR functions it may remove some of the problems.

Though it doesn't seem to be doing that.

I put the wipe part in the same loop as the OR and still the same.

So I am missing something.   (An elephant - I believe is the term used.)

It is not easy for me to explain what is going on as a lot of it is you have to see it rather than me trying to explain it.
Granted that is MY problem.  But as I said:  I am trying.
2  Using Arduino / Programming Questions / Re: Two sketches. One works, one doesn't. on: September 13, 2014, 05:27:16 pm
Granted.

But would it fix the problem I mentioned?

3  Using Arduino / Programming Questions / Re: Two sketches. One works, one doesn't. on: September 12, 2014, 09:52:57 pm
I've modified my code to this:

Code:
   copy_count = 0;
   while (copy_count <LED_Loop)
   {
     //
     A_R = H_R[copy_count]|M_R[copy_count]|S_R[copy_count];
     A_G = H_G[copy_count]|M_G[copy_count]|S_G[copy_count];
     A_B = H_B[copy_count]|M_B[copy_count]|S_B[copy_count];
     strip.setPixelColor(copy_count,A_R,A_G,A_B);


Interesting that when the SECOND hand moves over the HOUR hand, the LED goes PINK/MAGENTA.   (RED + BLUE)
However, when the SECOND hand goes over the MINUTE hand, it stays BLUE!

Now, another thing which is happening is that as the minutes tick over,  the OLD minute is not "turned off".

To get around that - or so I thought I did this:

Code:
   copy_count = 0;
   while (copy_count <LED_Loop)
   {
     strip.setPixelColor(copy_count,0x000000);
     copy_count++;
   }

   copy_count = 0;
   while (copy_count <LED_Loop)
   {
     //
     A_R = H_R[copy_count]|M_R[copy_count]|S_R[copy_count];
     A_G = H_G[copy_count]|M_G[copy_count]|S_G[copy_count];
     A_B = H_B[copy_count]|M_B[copy_count]|S_B[copy_count];
     strip.setPixelColor(copy_count,A_R,A_G,A_B);


So, although the strip isn't shown, the old data is wiped.  Or so I thought.
Still plodding away and learning - slowly.
4  Using Arduino / Programming Questions / Re: Two sketches. One works, one doesn't. on: September 12, 2014, 09:21:01 pm
Ah!

Found a big problem.

I had:

Code:
     strip.setPixelColor(copy_count,H_R[copy_count]|M_R[copy_count]|S_R[copy_count]|X_R[copy_count]);
     strip.setPixelColor(copy_count,H_G[copy_count]|M_G[copy_count]|S_G[copy_count]|X_G[copy_count]);
     strip.setPixelColor(copy_count,H_B[copy_count]|M_B[copy_count]|S_B[copy_count]|X_B[copy_count]);

When I should have had:

Code:
strip.setPixelColor(copy_count,H_R[copy_count]|M_R[copy_count]|S_R[copy_count],H_G[copy_count]|M_G[copy_count]|S_G[copy_count],H_B[copy_count]|M_B[copy_count]|S_B[copy_count] );

Now for the fun of the extra stuff.
5  Using Arduino / Programming Questions / Re: Two sketches. One works, one doesn't. on: September 12, 2014, 09:09:54 pm
Yes, I have worked that out.
(See last part of other post.  It was a PS addition)

Given that, I am still a bit confused.

The time units (hours, minutes and seconds) are got, hours "converted" to better represent the hour hand position.

Their colours are set in their arrays, yet all I am getting is a blue circle of LEDs.  Slowly starting off all turned off, and turning on one by one as the minute goes by until they are all on.

Ok, that is probably me and the code:  Not turning them off.

But why aren't the minutes and hours showing up?
6  Using Arduino / Programming Questions / Re: Two sketches. One works, one doesn't. on: September 12, 2014, 08:56:17 pm
El supremo.

Thanks.

I can't say.

When I compile it I get:
Binary sketch size: 9,070 bytes (of a 32,256 byte maximum)

So could you help me understand why?

Or could you help me with what I am trying to do?
I'm using arrays to supposedly make it easier to "merge" the colours when the hands overlap.

I just took out the X_R, B and B part and it works.

But I get a whole ring of BLUE ONLY leds.

7  Using Arduino / Programming Questions / Two sketches. One works, one doesn't. on: September 12, 2014, 08:21:47 pm
Ok, I am going to have to cop this.

I am working on a clock.

The first  code I wrote is ok.
It works.
I see the initial setup on the serial port.

I am trying to change the code to make arrays for the values.

The new code HANGS.

I don't even get the initial setup on the serial port.
V5 works.
V6 doesn't.


And yes there is a lot of crap in 6, but it is outside the loop and "sectioned off".
There are no compile errors, but it just hangs.

I don't get it.
(Sorry, now both files included.)
8  Using Arduino / Programming Questions / Re: More qusetions about "functions" and how they work. on: September 12, 2014, 04:59:14 pm
AFAIK constantly.

Dumb question:  Have you looked at the sketch?

I am now working on a new approach:
Yes, is it WAY different.  WAY WAY WAY!

H_R[60]
H_G[60]
H_B[60]

M_R[60]
M_G[60]
M_B[60]

S_R[60]
G_G[60]
S_B[60]

X_R[60]
X_G[60]
X_B[60]

X is for "digits".  Be it 12, 3, 6, 9 or all 12, and may be alarms.

Each loop will set the H, M, and S values for what is going on.

Then it LOGIC ORs the R's G's and B's into the neopixel( ) string thingy and then strip.show();

I am "forced" to do it that way as I am not smart enough yet to do it with the RGB composite numbers as one set of parameters.


9  Using Arduino / Programming Questions / Re: More qusetions about "functions" and how they work. on: September 12, 2014, 02:26:38 am
I think you are making more complicated that it is.
To set LED to red you code sends RGB = (255,0,0) , to set  blue you send RGB (0,0,255).
Now if you set SAME LED using BOTH codes it will PHYSICALLY mix the colors.
The software does not care if you send TWO lines of code to sane LED "output"
Color(255,0,0);
Color(0,0,255);
or ONE line of code
Color(255,0,255);  to same LED

Ok, home and a bit more time to reply.

My code does that - basically.

Code:
 /*----------------  Draw SECOND HAND on clock ----------------*/
   strip.setPixelColor(second_led,SE_Colour);
//   strip.setPixelColor(second_led,SE_Colour+THIS_LED);
//   strip.setPixelColor(second_led-1,THIS_LED);
   if (new_minute == 1)
   {
     //new_minute = 0;
//     strip.setPixelColor(minute_led-1,MN_Colour/50);
   }
  /*----------------  Draw MINUTE HAND on clock ----------------*/
   //strip.setPixelColor(minute_led,MN_Colour);
   //  MN_Fade for fading.
   strip.setPixelColor(minute_led,MN_R,MN_G,MN_B);
   strip.setPixelColor(minute_led+1, MN_R,     (MN_G * (second_led*10/6)/100)      , MN_B);
   strip.setPixelColor(minute_led-1, MN_R,     (MN_G * (100-(second_led*10/6))/100)      , MN_B);
  /*----------------  Draw HOUR HAND on clock ----------------*/
   strip.setPixelColor(hour_led,HR_R,HR_G,HR_B);
   //strip.setPixelColor((hour_led-1)%LED_Loop,HR_R/HR_Fade,HR_G,HR_B/HR_Fade);
   //strip.setPixelColor((hour_led+1)%LED_Loop,HR_R/HR_Fade,HR_G,HR_B/HR_Fade);


The minute hand is a bit tricky, but look beyond that.

But as the three "hands" are R G and B, why is it then that when the hands pass one another they OVERWRITE one another, rather than "blend" with each other?

That is why I am asking the question/s.

check my sketch:
http://forum.arduino.cc/index.php?topic=265294.0

Anyway, I shall play with the idea and learn if nothing else.

Thanks again.

I shall put more work/effort into it soon I hope.

P.S.
Just looked at that again:
The software does not care if you send TWO lines of code to sane LED "output"
Color(255,0,0);
Color(0,0,255);
or ONE line of code

No, I can't see how that would be the same.
The first line sets Red to 255, 0, 0.
But the second line:
0,0,255, would wipe out the first 255 instance.  Because it sets the value to zero.

If there was a "wild card" there I could believe it.
But in retrospect, I'm not sure.


10  Using Arduino / Programming Questions / Re: More qusetions about "functions" and how they work. on: September 11, 2014, 11:59:34 pm
Wow!

That was great!

Thanks very much.

That may be a missing link for me to get more out of things.

What I am thinking of doing is making an array:

Can I have 2 dimensional arrays?

Like:   time[60.4]?

That way I can have the "hour" in one array, "minute" in another, and "second" in the third.
The fourth would be  a composite of the other three.

Then each cycle I can cycle the time[i.4] from 0 to 59 and show all the leds.

Here's hoping that can be done.
11  Using Arduino / Programming Questions / Re: More qusetions about "functions" and how they work. on: September 11, 2014, 08:28:17 pm
Valcav,

Nearly.

I'll try to explain better now.

Forgetting that there are 60 LEDs......

An LED is set to RED (and that is to keep it easy for me too).  When the Second hand moves onto that LED, I want a composite of the two colours.

So:  Seconds are BLUE.

The RGB would be:
55,00,00

The other value is:
00,00,55

I "OR" those together and get:
55,00,55

Then when the second hand moves off that LED, I need to restore it to the original colour.
So I would AND the LED.
55,00,55 AND 55,00,00
Gives:  55,00,00.

But doing that in a NEAT way - as a function - is still a bit beyond me.

12  Using Arduino / Programming Questions / Re: More qusetions about "functions" and how they work. on: September 11, 2014, 08:14:26 pm
Thanks.

I just upgraded to the new IDE (windoze) and it was giving me grief.

I thought part of that was to do with either multiple sends or returns to functions.

Anyway, I'll try to get more work done this weekend on learning more.

smiley
13  Using Arduino / Programming Questions / More qusetions about "functions" and how they work. on: September 11, 2014, 06:40:05 pm
It isn't that I really want a lot of posts but the "Theme" has changed and so a new post.

I have been "caught out" with either sending multiple variables to a function or trying to return multiple variables.
This has only recently happened where errors have happened and I am sure my older alarm clock sketch was "guilty" of doing that.
But as it works, I don't want to tempt fate.

Ok the dilemma:
I am reading a C++ for dummies book and it talks of "OOP"  - Object Oriented Programming.
I think I have a grasp of that but when I try to apply it, things fall over.

Example:
On my NEOPIXEL clock - sketch in another thread in the showroom - The Hours are Red, the Minutes are Green and the seconds are Blue.

When two of the hands are at the same position, there is a "problem".

I want to write some code to AND the two colours together and display that colour for that position.

This would be with a "function" - I am guessing.
But to do that:  The function would need BOTH colours to OR together.

Then, after the second hand has "moved on", it needs to restore the original colour to the LED one behind.
Again it would need BOTH colours to AND together to return the original colour.

I don't understand enough of the lingo' to be able to write something to do that.

Other than making the variables GLOBAL.

Please........

Anyone?
14  Using Arduino / Microcontrollers / Re: Camera control project build. on: September 10, 2014, 03:59:02 pm
Not bad, but I am using CButton and that is even better.    smiley-razz

Shame you didn't know if the keypad I mentioned.  That would have been good for what you needed.

One thing I notice:
You are using resistors to "pull up" the inputs.  So when the button is pressed the line goes low.
(or vice versa)   

You know you could save pins by setting the internal pull up resistors on?

Just a suggestion.

Anyway, good luck with it.
15  Community / Exhibition / Gallery / Re: Using an Arduino for high speed photography on: September 06, 2014, 04:41:59 pm
Very nice.

I am working on a similar project.

Though not as big.

Mine (I hope) will be the size of ...  Well, hand sized.

I have to work on the flash part too.
Pages: [1] 2 3 ... 54