Show Posts
Pages: 1 ... 37 38 [39] 40 41 ... 80
571  Using Arduino / Programming Questions / Re: I don't understand the UTouch library. on: March 15, 2013, 01:53:18 am
What does not work? What are you expecting to happen that does not?
572  Using Arduino / LEDs and Multiplexing / Re: controlling several LED's with one button on: March 15, 2013, 01:47:20 am
What have you got so far?
What is your circuit?
573  Using Arduino / Programming Questions / Re: How to declare arrays in another (not main) tab? on: March 14, 2013, 11:10:38 pm
Have you declared the macro arracys as extern? If you haven't, try it. If it still does not work, post the two files...
574  Using Arduino / Programming Questions / Re: extract 4 bits from 8 bits .... on: March 14, 2013, 08:38:42 pm
The reverse.

You shift to the right by how many bits you need (creating zeros in the bottom part) and then 'or' in the other part

(x << 3) | y
575  Using Arduino / Programming Questions / Re: How to declare arrays in another (not main) tab? on: March 14, 2013, 07:34:10 pm
Quote
I want to put the macros declared at the top into another tab, or maybe into an external file (if that is a better solution).
Another tab is another file.

So what is the problem? You don't seem to have them split out yet. What error are you getting?

If you are declaring in one file and then using in another, you will need to declare the array as 'extern' in the file where is is not declared, like
Code:
extern int varname;
576  Using Arduino / Programming Questions / Re: How to declare arrays in another (not main) tab? on: March 14, 2013, 06:49:32 pm
It is possible so you will need to post your code so it can be reviewed.
577  Using Arduino / Programming Questions / Re: extract 4 bits from 8 bits .... on: March 14, 2013, 06:44:42 pm
Code:
a = 1000110
var1 = (a & 0x78) >> 3;
var2 = (a & 0x7);

generally you need to mask with all the bits on (0x78 = 0111 1000) that youwant to keep and then shift to the right by the number of bits you want to eliminate (in this case 3). It is more common to split into 4 bits so mask is 0xf for one var and 0xf0 and then shift by 4 for the other (or just shift by 4).
578  Using Arduino / Programming Questions / Re: Printing a word in a LCD display on: March 14, 2013, 02:12:19 am
Code:
char d = ('%s : %s : %s', a, b, c);

is incorrect.

Code:
char s[10];

sprintf(s, "%d:%d:%d", a, b, c);
lcd.print(s);

use %02d to get 2 digits always.
579  Using Arduino / Displays / Re: utft code issues on: March 13, 2013, 08:20:56 pm
Can you find the full stop on the keyboard? It is right next to the comma on mine smiley

I would start by putting the things you want to do (ie, each screen of information) in a separate function that clears the screen and then does what it needs to do. You can the use the loop() function to coordinate between the different functions to move around.

You will need to learn how to program wihtout using the delay functions (the technique is shown in the BlinkWithoutDelay example) so that you can 'run' the user interface. The loop() function then is able to 'do' stuff in the background while the user makes up their mind what they want.
580  Using Arduino / Sensors / Re: Digital input frequency on: March 13, 2013, 04:01:33 pm
Quote
get a copy from the TCS sensor library at my site
Maybe that was not clear, but it is bundled in my library for the TCS230 color sensor. Anyway, looks like someone else found it as well.

Quote
that this is needed for high frequencies (2kHz and up) i don't think that i will be in the need for such high frequencies
In the same place there is library called FreqMeasure that is for lower frequencies. How you count changes in order to retain accuracy.

Quote
Is this library neccesary for just counting pulses?
Not at all. You can just count pulses either by polling the I/O and detecting rising or falling edges, or you can use an interrupt to do the counting work in the background. The point is that your 'high' frequecy is actually not that high and the Arduino is more that capable of doing what you need (which answers your original question).

Your application is actually not a frequency count application but just a straightforward pulse count of the flowmeter for valve control, so use of the frequency counting libraries is probably not what you need anyway.
581  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).
582  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 ...
583  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
584  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?
585  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.
Pages: 1 ... 37 38 [39] 40 41 ... 80