Show Posts
Pages: 1 2 3 [4] 5 6 ... 1856
46  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 28, 2014, 01:47:06 am
I think you're misunderstanding what a cast is.
It's just a promise to the compiler (which is doing its best to protect you from yourself) that "Hey, I know what I'm doing here - it'll all be OK, trust me".
It doesn't physically transform, move or modify anything.
47  Using Arduino / Programming Questions / Re: Array Difficulties on: July 28, 2014, 01:37:22 am
I don't understand the point of a 1x10 array, and I'm not even sure I understand why you're using an array.
If all you want to do is move a four bit mask around, then the << and >> shift operators seem to fit the bill.
48  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 03:49:53 pm
Quote
The second line you have created an unsigned integer that consists of 8 bytes and set it equal to and then I get lost. (uint8_t *) &number
I take the address of "number" using the & operator.
The address of "number" is a pointer to an "unsigned int".
I can't assign a pointer to an "unsigned int"  to a pointer to "uint8_t", so I cast it.

I can't see where you think eight bytes comes into it.
The 8 in uint8_t refers to the number of bits in the type.
49  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 03:38:36 pm
Quote
If that is so easy then why are there so many people complaining about ways to send int via vw_send
One != many
50  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 03:33:08 pm
Code:
unsigned int number = 2;
uint8_t *pointer =  (uint8_t*) &number;
vw_send(pointer
51  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 03:23:58 pm
Quote
And I cannot create a char pointer that points to an int?
You most certainly can.

Quote
Because vw send wants a char pointer?
No, it wants (demands) a uint8_t pointer
52  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 03:18:05 pm
Quote
If a pass a pointer that points to an integer vw_send then why does vw send complain?
It does not complain if you pass it the correct pointer type.
53  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 03:06:42 pm
Quote
There are 12 bits or 2 bytes.
Sp. "16 bits"

Quote
does vw_send view those two bytes only as bytes irrespective of if they were chars or int?
Absolutely right.

Imagine every brick in a Lego set were made of four stud bricks glued together.
An eight stud brick is just two four studs.
54  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 02:50:45 pm
Quote
Books certainly don't say that?
They certainly do.

Quote
And how does accessing the bytes one at a time make convert an int to a char?
It doesn't convert it.
To send an int  over a serial link, typically, you send it byte by byte, so you need a way of breaking down the int into its component bytes.
A pointer allows you (the virtual wire library) to do this.
55  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 02:41:11 pm
A uint8_t pointer just allows you to access the two bytes of an int one at a time.
56  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 02:29:32 pm
Quote
uint8_t stands for unsigned integer?
Yes, it is an eight bit unsigned integer.

Quote
So why does that send an integer
It doesn't. We've been through this already.
The asterisk make the data type a POINTER to an eight bit unsigned integer.

Quote
say u can only
We've been through this already too-
57  Using Arduino / Programming Questions / Re: what is the difference between char and int and why can you not convert them? on: July 27, 2014, 02:18:35 pm
It fetches one byte for a char, and two for an int.
They're both signed.

Code:
(char)variable 1;
Quote
Then I get errors
Not surprising.
58  Using Arduino / Project Guidance / Re: Projector hardware? on: July 27, 2014, 10:56:35 am
You could use an old-school galvanometer movement.
59  Using Arduino / Project Guidance / Re: GPS on Sport's Fields - too much error on: July 26, 2014, 05:50:57 pm
You need to Google "differential GPS"
60  Using Arduino / Programming Questions / Re: Sensor Range Coding Error Help on: July 26, 2014, 05:44:30 pm
Code:
#include <microsecondsToinches>
Where did you put that?
Pages: 1 2 3 [4] 5 6 ... 1856