jlefevre1

I need to move 1 unsigned long integer over the serial port from one arduino to another , over and over, without stopping, as fast as I can. Basically I will encode the bits of the integer in one arduino and then send that unsigned long integer to another arduino to decode them. I will do this over the serial port at 9600 baud. This is to control christmas lights next year so it has to happen really fast to keep the lights up with the music. I am currently doing this with a string of 6 integers, comma delimited and ending the string with a ; It works but I have to put a 300 ms delay on the transmitter or the decoding fails on the other end. And the data rate is to slow. I have read all of the libriaries and find the definitions for the serial stuff very confusing. I can get the serial print statement to work nicely at all speeds even with the delay between print statements eliminated. But getting the receiver to decode it without the delay of at least 300 ms between transmissions falls flat on its face. I came up with the idea of just using the single 32 bit unsigned integer instead of the 6, 16 bit integers withe the comma delimiter because I thought that should be more simple to speed up. But I am unsure how to proceed.

300 millisec delay required! I suspect you are doing something wrong in the receiver sketch such as using delay commands or other blocking commands that is causing your serial receiver buffer to lose characters. Post your code if you really want help.

PeterH

I need to move 1 unsigned long integer over the serial port from one arduino to another , over and over, without stopping, as fast as I can.

That sounds like the solution to some problem, and not a very smart solution at that. You're trying to turn lots of LEDs on and off individually? How many - and what sort of latency do you want to achieve? Where are the LED commands coming from?

jlefevre1

9600 baud is a necessity. I will be sending from one Arduino as the transmitter to multiple Arduinos as recievers. And this will be done using 900 Mhz RS232 wireless serial radios. They top out at 9600 baud. Without the delay in the transmitter program and using the serial monitor on the software to see what the transmitter is putting out with the present 6 integer, comma delimited stream, the speed ismore than quick enough. But the receiver cannot read it and stuff it back into 6 sets of integers. Right now for testing I am just connecting the Tx out of the transmitting Arduino to the Rx of the reicever on my workbench. I will put the radios in later but they are not part of the equation now. I will be using the 32 bits of the single long integer in various ways. 5 groups of 4 bits will be scaled from a binary 0-15 to a integer of 0 - 255 to drive 5 PWM outputs. 7 bits will directly control 7 outputs of the Arduino directly. Either on or off. One of the bits will be a system on - off bit. When off all of the outputs and the PWM values will be set to 0 . The rest of the 32 bits are spares for now.

dhenry

Use the hardware spi or uart, plus interrupts: configure the modules to trigger an isr when the data register is empty (or the transmission is done). In the isr, load up the next byte, until all four bytes / string have been done.

The speed will be blindingly fast, and it is a send-and-forget type.

PeterH

Use the hardware spi or uart, plus interrupts: configure the modules to trigger an isr when the data register is empty (or the transmission is done). In the isr, load up the next byte, until all four bytes / string have been done.