Show Posts
Pages: 1 ... 37 38 [39] 40 41 ... 79
571  Using Arduino / Sensors / Re: Digital input frequency on: March 13, 2013, 06:55:28 am
There is a library I have used before - Freqcount.  Google it or you can get a copy from the TCS sensor library at my site (see below in the signature block).
572  Using Arduino / LEDs and Multiplexing / Re: How would you connect these boards together? on: March 13, 2013, 12:52:20 am
Cable joining is the way to go with these boiught ones as it is the only way to get a continuous led matrix.

I have just put in to seeedstudio my own pcb design that allows them to be plugged together side by side to make a modular display board. Waiting for the boards to come back ...
573  Using Arduino / Programming Questions / Re: A function to get the number of variables in an array? on: March 12, 2013, 11:03:43 pm
... all to fit data in a few kb of stack space?

With the large numbers of beginners on this forum, the simpler structures/concepts are far more effective than complexity. Relatively advanced topics are, imho, not for people that often struggle to make 2 LEDs blink (as interesting as the discussion may be for subject matter experts).

I have been programming Arduino for about a year now. I have a background in real time programming under Unix, Windows, and VMS, using C mostly. In my experience, the fewer layers between hardware and software, the more understandable things are and the more reliable the (real-time) result.

An opinion.  smiley-wink
574  Using Arduino / Programming Questions / Re: A function to get the number of variables in an array? on: March 12, 2013, 05:09:50 pm
This is becoming a very esoteric topic for what is usually a non-issue in code - either you know the size of the memory block at compile time (because it is a constant) or you allocate the memory by telling the libraries how much you want (in which case you know before you ask).

Getting back to basics - what are you trying to achieve?
575  Using Arduino / Storage / Re: TinyFAT Library on: March 12, 2013, 12:13:47 am
Look at sprintf()   You format a string that you can then write to the file.
576  Using Arduino / Programming Questions / Re: Parse a date & time string on: March 12, 2013, 12:07:53 am
If you have affixed format string then you can just pick out the characters and remap them into your required sequence. For example, you might take the 10 th character of the string and put it in the first position of your string, etc.

However, if the string changes by just one character position at any time you will be out.
577  Using Arduino / Programming Questions / Re: Parse a date & time string on: March 11, 2013, 06:58:37 pm
A few issues here:
1. You cannot have a main() in the Arduino world as that is in the library. Put the code in setup() if you want to run it once.
2. You have a " in the string, which also happens to be the token defining the beginning and end of the string in C. You need to 'escape' this token at compile time by (from memory here) putting it in twice "" so your string should become
Code:
"+CCLK: ""00/06/09,17:34:23"""; 

If you were receiving the string thru a serial link or other comms, then there is no need to escape as the string is not being interpreted by the compiler.
578  Using Arduino / Programming Questions / Re: A function to get the number of variables in an array? on: March 11, 2013, 06:53:47 pm
You cannot malloc() at compile time because you need to call a function, which only happens when the code starts running. Declaring an array like a[10] is how you allocate the memory at compile time.
579  Using Arduino / Programming Questions / Re: LCD Producing Garbage After Time on: March 11, 2013, 06:51:47 pm
Technically you turn off the updates and then turn them back on. The power to the lcd stays on and the display stays powered on. You should not have any delay()s in the on/off bracket of code or it will be noticeable.
580  Using Arduino / Sensors / Re: Different behaviour of Analog ports (A0 vs Ai) on: March 11, 2013, 05:10:45 pm
Quote
I mean you put the pin to read and write?

Actually I think it only sets it to write as the last statement overrides the first.
581  Using Arduino / Programming Questions / Re: Parse a date & time string on: March 11, 2013, 05:08:03 pm
strtok() may provide you with the answer for the location of the separators (in your case " and , and " again). Then you can strncpy() out the sections starting at the first 2 locations, length given by the difference to the location of the nect token.
582  Using Arduino / Programming Questions / Re: LCD Producing Garbage After Time on: March 11, 2013, 05:04:06 pm
A simple thing to try that has helped me in the past. Before you do a block of updates to the LCD, use lcd.noDisplay() and then turn it on again at the end with lcd.display(). Thgis stops the display updating immediately but changes the memory buffer of the display. It makes no difference to the perception of updates on the display but fixed my (occasional) odd character apprearing on the screen.
583  Using Arduino / Programming Questions / Re: A function to get the number of variables in an array? on: March 11, 2013, 04:57:20 pm
Same idea, but I usually use the following construct
Code:
#define ARRAY_SIZE(x) sizeof(x)/sizeof(x[0])

then in code use (for example)
Code:
int  arr[] = {1, 2, 3, 4, 5, 6};
for (uint8_t i=0; i<ARRAY_SIZE(arr); i++)
  // do something

I find it easier to read the intent of the sizeof() statements when scanning code.

As already stated, this is resolved at compile time and so does not suit dynamically allocated arrays.
584  Using Arduino / Displays / Re: Error when compiling.. on: March 11, 2013, 04:50:34 pm
Quote
How can I solve this?

Posting the code as well as the error message would help us.
585  Using Arduino / Sensors / Re: Different behaviour of Analog ports (A0 vs Ai) on: March 11, 2013, 04:48:32 pm
Make sure you connect all 3 pins of the pot. One end goes to gnd, the other to +5V. The wiper (usually the middle connection) should be connected to your analog input.
Pages: 1 ... 37 38 [39] 40 41 ... 79