Show Posts
Pages: [1] 2 3 ... 99
1  Using Arduino / Project Guidance / Re: Newby that wants to build an agv on: September 15, 2014, 04:32:35 pm
oh, *agv*, I thought you meant *argv* and I was going to say that that was not possible on the arduino.
2  Using Arduino / Programming Questions / Re: memcmp() on: September 15, 2014, 03:56:57 pm
How about the arduino libc docs:
The memcmp() function compares the first len bytes of the memory areas s1 and s2. The comparision is performed using unsigned char operations.

Looks like we are both right. 8^)
3  Using Arduino / Programming Questions / Re: memcmp() on: September 15, 2014, 03:17:36 pm
That definition would only apply on machines where CHAR_BIT is 8, which, while common, is not a requirement of C, which is why more correct language uses the more generic "array of characters".

Unless, of course you allow for 9-bit bytes.
4  Using Arduino / Programming Questions / Re: memcmp() on: September 15, 2014, 12:58:18 pm
Don't get hung up on the name. 'char' does not imply text. In C, a char is simply the smallest addressable area of storage, which does not have to be a byte. In the original versions of C there was no void pointer and a char pointer was used as a generic pointer.

And yes, sizeof(char) is *defined* to be 1. I am not sure what Unicode has to do with this since they are wchar_t.

Don't argue with me. Take it up with K&R, Harbison and Steele and *The C Programming Faq*.

5  Using Arduino / Project Guidance / Re: Wireless network without coordinator on: September 15, 2014, 10:06:39 am
I assumed that you were trying to avoid collisions with the GPS. If 10 meters is good enough, great.
6  Using Arduino / Programming Questions / Re: memcmp() on: September 15, 2014, 10:02:12 am
Take it up with K&R then, as I quoted. The name for an arbitrary block of memory in C is "an array of characters", after all, the sizeof(char) is defined to be 1.
7  Using Arduino / Project Guidance / Re: Wireless network without coordinator on: September 11, 2014, 05:16:20 pm
I assume you know that you will need DGPS for this, since GPS is not nearly accurate enough.
8  Using Arduino / Programming Questions / Re: memcmp() on: September 11, 2014, 04:34:11 pm
I think the problem is the implied conversion from int* to void*. That conversion loses any information as to the size of each cell in the array.  As far as I can tell, memcmp() compares *characters*. Since the size of your array is 2 elements, the 2 passed to memcmp() equates to 2 *characters* not 2 ints, so you will only compare the first int in your case.

K&R provide a hint when they say: "The mem... functions are meant for manipulating objects as character arrays; the intent is an interface to efficient routines."

So, in your case here, the size parameter should just be array, not array/array[0] so you know the size in bytes(characters) not the number of elements.
9  Using Arduino / Programming Questions / Re: string length help on: September 11, 2014, 01:14:42 pm
Well it *would* if the arduino sprintf() supported floats, which it does not. Use dtostrf().
10  Using Arduino / Programming Questions / Re: Arduino not incrementing correctly on: September 10, 2014, 05:39:06 pm
increment integers, and then do this:
i = i+1
double n = i*.0001
11  Using Arduino / Programming Questions / Re: expected ',' or '....' before numeric constant on: September 10, 2014, 10:03:45 am
8 and 9 *were* octal digits before ANSI C. 8^)
12  Using Arduino / Programming Questions / Re: Pid motor control - matching a tapped tempo on: September 09, 2014, 05:45:25 pm
If you know what RPM you need and are measuring it, just go there with a simple control loop. The motor responds fast enough that PID isn't needed.
13  Using Arduino / Programming Questions / Re: Expected unqualified-id before 'else' error on: September 09, 2014, 01:58:32 pm

All the # statements need to be at the top of the sketch.

Nope, #defines can show up anywhere, but they will only be visible to code below it in the file, which can be problematic on the arduino since it munges files together.
14  Using Arduino / Programming Questions / Re: Problems with strcpy on: September 08, 2014, 12:20:53 pm
Then your arrays are not nul ('\0')terminated.
15  Using Arduino / Microcontrollers / Re: SN74LS86 Pinout on: September 05, 2014, 01:13:23 pm
Did someone sell you an SN74LS86 telling you it was a microcontroller? If so, you got ripped off. I hope it was cheap!
Pages: [1] 2 3 ... 99