Forum Replies Created
-
AuthorPosts
-
February 16, 2015 at 4:24 pm in reply to: a function with a total of 1500ms delays makes it unstable #3287BillMember
wkinne,
you’d have to post all of your code before anyone could really help.
BillMemberDo you see the debug statements in you serial terminal each time you push a button?
BillMember3lectricswine,
Those kind of distances are going to be trouble with serial. Your two options are to go balanced serial (Rs-485) or maybe just going ethernet using Ethernet shields.
BillMemberI’ve commented out the references to these header files as they should not be needed.
BillMemberPhil,
Using a software serial port is about the only way to do what you want. Can the Xbee data be slowed down to sat 9600 baud?
BillMemberHmm,
avr/io.h should not be needed, so you should be able to remove that without issues. It’s probably a relic from an old version.
Why it won’t work on a Galileo I don’t know. The ET library uses the Stream class and should be portable with the Arduino IDE. Actually, maybe not. The Galileo may not be able to handle the malloc memory initialization. I’d have to get my hands on one or someone else try modding the library to not dynamically alloicate memory for the receive buffer.
February 16, 2015 at 3:55 pm in reply to: Problem getting stable data from I2C sensor when receiving by SoftEasyTransfer #3281BillMemberI would first suggesting using 2 different structures; 1 for transmitting A to B and one for receiving B to A. It looks like you tried using 1 structure with 2 sets of values, which would cause issues of local data being overwritten by garbage data from the other Arduino.
BillMemberBravado,
Without seeing all your code everything you reported here should work. You are well under the byte limit so it may be something else going on.
You could store your bool values into 2 bytes instead of 10 (Bool values are a byte each even though they are 2 state). Each bit in the byte could represent a a different flag.
BillMemberYep, ACK and rumble power are not needed. Glad you got it to work.
BillMemberDepends on their size. At most you can have 255 bytes in the structure.
BillMemberShort answer: Don’t do that.
Strings in Arduino are a special type. In simple C strings are just arrays of characters, and you could transfer that. But it’s horribly inefficient. And the library has a limit of 255 bytes of data, or only 255 characters in a string.
So if you really wanted, you would have to convert strings to arrays of characters before sending them via ET.
But what are you really trying to do? Just send status messages?
BillMemberps2x.ButtonDataByte() will return 2 bytes representing all the current buttons pressed.
You could use that to test multiple button presses at once.
Here is the bits in that word and what buttons they represent:
//These are our button constants#define PSB_SELECT 0x0001#define PSB_L3 0x0002#define PSB_R3 0x0004#define PSB_START 0x0008#define PSB_PAD_UP 0x0010#define PSB_PAD_RIGHT 0x0020#define PSB_PAD_DOWN 0x0040#define PSB_PAD_LEFT 0x0080#define PSB_L2 0x0100#define PSB_R2 0x0200#define PSB_L1 0x0400#define PSB_R1 0x0800#define PSB_GREEN 0x1000#define PSB_RED 0x2000#define PSB_BLUE 0x4000#define PSB_PINK 0x8000#define PSB_TRIANGLE 0x1000#define PSB_CIRCLE 0x2000#define PSB_CROSS 0x4000#define PSB_SQUARE 0x8000BillMemberThat would work, you can also read data a certain number of times and then break if nothing came back. like:
int i=0for(; i<10; i++){
if(ET.receiveData()) break;
else delay(100);
}
if(i==10) //put failure code here, since the for loop never broke before i got to 10.
But there’s no right way, it’s whatever way you want to do it. The library itself will never lockup your Arduino because no data is received.
BillMemberYes, use the Software easy transfer library instead. There should be an example sketch in the download for software easy transfer.
BillMemberNo idea. Ever figure it out?
-
AuthorPosts