Show Posts
Pages: 1 [2] 3 4 ... 98
16  Using Arduino / Programming Questions / Re: Setup called inside Loop- what is going on? on: August 20, 2014, 05:50:48 pm
One other minor point:
the syntax:
Code:
(void)setup();
is perfectly valid, it tells the compiler to ignore any return value from this function. It is not necessary in this case, but shouldn't hurt. It is usually used in code like this:
Code:
(void)sprintf(...);

where you are telling the compiler that you are throwing away sprintf()'s return value on purpose. Some code checking programs like lint will complain if you throw away a return value silently.
17  Using Arduino / Microcontrollers / Re: existentialist question: why arduino leonardo Takes that name? on: August 19, 2014, 12:03:51 pm
Are you a Carl Sagan fan?
http://en.wikipedia.org/wiki/Power_Macintosh_7100
18  Using Arduino / Programming Questions / Re: String.length() always return 0 on: August 19, 2014, 12:00:06 pm
Is your length() method in the global area? It might need to be in an actual code section.
19  Using Arduino / Programming Questions / Re: String.length() always return 0 on: August 19, 2014, 11:49:47 am
Constructive help:
Ditch String.

Use string.h and strlen().

More constructive help:
Provide a compilable, runnable example.
20  Using Arduino / General Electronics / Re: What is a calabrating battery type called? on: August 18, 2014, 03:32:37 pm
http://www.nist.gov/calibrations/voltage.cfm
21  Using Arduino / Programming Questions / Re: multiplication problems on: August 18, 2014, 11:53:08 am
Yes. as was already said:
Quote
You're probably using signed variables, which when the number gets big enough to make the left most bit a 1, actually goes -ve becasue the left most bit is the sign.
22  Using Arduino / Programming Questions / Re: multiplication problems on: August 18, 2014, 11:42:59 am
You're probably using signed variables, which when the number gets big enough to make the left most bit a 1, actually goes -ve becasue the left most bit is the sign.

Use unsigned and you'll be good....

Unsigned can overflow, too.
23  Using Arduino / Programming Questions / Re: multiplication problems on: August 18, 2014, 11:42:01 am
Show your code.

However, in this case I can psychically determine the issue: Your multiplication results are too big to fit into the type chosen, which might be intermediate types chosen by the compiler to perform constant pre-calculating.
24  Using Arduino / Programming Questions / Re: I cant insert code, please help..... on: August 18, 2014, 11:31:18 am
There is nothing "unstable" about braces '{}'.

Use them when you want to group several statements as one, or as part of a function definition.
25  Using Arduino / Programming Questions / Re: How do I understand all the libraries required to program a quad copter? on: August 18, 2014, 11:14:56 am
What is your background and current knowledge in physics and math, including tensors?
26  Using Arduino / Programming Questions / Re: About the "int" data type variable on: August 14, 2014, 02:10:47 pm
I didn't say *use* a bitfield, I said check it out. 8^)

And I am sure a compiler could work things to have an addressable single bit variable.

From the C programming FAQ:

"Some 64 bit Cray machines represent int * in the lower 48 bits of a word; char * additionally uses the upper 16 bits to indicate a byte address within a word."
27  Using Arduino / Programming Questions / Re: [FreeIMU library] errors within the library? on: August 14, 2014, 12:46:58 pm
It is only defined if all those others are defined.
28  Using Arduino / Programming Questions / Re: [FreeIMU library] errors within the library? on: August 14, 2014, 11:37:54 am
Ugh, that is pre-processor abuse.

Are you sure HAS_ITG3200() is defined? Though those parens look odd.
29  Using Arduino / Programming Questions / Re: [FreeIMU library] errors within the library? on: August 14, 2014, 11:11:29 am
Why is that #endif right below the function declaration?
30  Using Arduino / Programming Questions / Re: About the "int" data type variable on: August 14, 2014, 10:06:35 am
A bool *could* be one bit, but it would take too long to access it, so the compiler makes it a byte for speed reasons.

C does allow for single-bit variables: check out bitfields.
Pages: 1 [2] 3 4 ... 98