Show Posts
Pages: 1 2 [3] 4 5 ... 99
31  Using Arduino / Programming Questions / Re: unsigned long operations gives unexpected result on: August 25, 2014, 03:11:12 pm
yb-ya is negative.
32  Using Arduino / Programming Questions / Re: Strange behaviour of "return value;" on: August 25, 2014, 11:53:04 am
Unconditional? In a row?

I said in a function.
33  Using Arduino / Programming Questions / Re: Strange behaviour of "return value;" on: August 22, 2014, 06:35:04 pm
Do you KNOW what return does? If ENDS the function. Having two return statements makes no sense. The second one is never executed.

There are lots of reasons to have multiple return statements in a function. It might be an error return, or two "forks" of processing . It is one of the easy ways to avoid gotos. 8^)

Now multiple *entry* points - which almost made it into C with the original "entry" reserved keyword, I am not so sure about.
34  Using Arduino / Programming Questions / Re: timmer resseting without complete reset of counter? on: August 22, 2014, 01:13:28 pm
Your long delay calculations don't fit into an int. Add a "UL" after one of the numbers to force the calculation to be unsigned long.
Code:
delay(15*60*1000UL)
35  Using Arduino / Project Guidance / Re: Fast analog polling on: August 22, 2014, 12:35:20 pm
Don't do serial writes while polling. save the data in an array and spit it out after the event.
36  Using Arduino / Programming Questions / Re: gps guided car on: August 21, 2014, 05:30:00 pm
You better have a big track, since GPS is only good to 10 meters or so.

Gather all the characters into a string and convert it with strtod().
37  Using Arduino / Project Guidance / Re: While wiht complex condition not executing on: August 21, 2014, 10:54:25 am
The only comment is to try to put the most likely condition first, since a logical statement like that will "short circuit" when the truth of the expression can be reliably determined.

In this case, if 'H' happens more often than 'k', move it to the head of the line.
38  Using Arduino / Project Guidance / Re: transer GPS coordinates over RFM12b on: August 21, 2014, 10:50:35 am
I am not familiar with tinyGPS - I wrote my own - but it might be better to send the coordinates as text, since that is what the GPS sends to the arduino anyway. If tinyGPS does not give you access to the actual NMEA string, you might want to write your own.
39  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.
40  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
41  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.
42  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.
43  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
44  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.
45  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.
Pages: 1 2 [3] 4 5 ... 99