xxninjabunnyxx:
i want to count the incoming bits from a serial connection, not pulses.
Can you clarify? A normal serial connection has 8 bits. Do you mean count 1 bits? 0 bits? Let's say you receive 0xFF. Do you count that as 8 x 1 bits? Or one long 1 bit?
Let's put that another way. What are you trying to achieve?
No offense to the non rookies but im sure if the op new exactly how to describe the problem it would be less of a problem and more of a google search
to the OP tho, I think you mean interpret the incoming values and alter to different values , usually all serial connections are pretty similiar with just a few options,
if you use a regular arduino uno you wil have to have a virtual serial connection for the input or output as the uno only has hardware for one connection
An arduino mega has multiple serial connections and can do it without a slower virtual serial connection
if the op new exactly how to describe the problem it would be less of a problem and more of a google search
Fair enough although we get a lot of people who couldn't be bothered with a Google search as well.
Here's some code that takes characters received on the serial port and transmits translated characters on the same port. (As this appears to be a one-way thing you only need a single port as long as both gadgets are running at the same baud rate).
byte out_values [256] = {
1,112,3,24,5,6,7,99, ... // 256 possible values in any order
}
loop () {
byte x;
if (Serial.available() > 0) {
x = Serial.read();
Serial.print (out_values [x]);
}
Whether or not it's appropriate to this application I have no way of knowing without proper details.
winner10920:
No offense to the non rookies but im sure if the op new exactly how to describe the problem it would be less of a problem and more of a google search
Yes, well to be fair, all I saw was someone playing a video game, with the camera panning over to what looked like an Arduino or similar with some wires running out of it. What was it converting, to what? What is the purpose? Does it let you use a controller for one system on another one? Is it some kind of macro device (eg. hit a button and it sends out 10 commands)?
Describing the basic idea doesn't require a lot of technical words.
winner10920:
as the uno only has hardware for one connection
Not true.
Arduino has only 1 hardware supported ordinary serial connection. It also has 1 hardware supported high speed serial connection. It -also- has the hardware to support several more of either kind through software manipulation.
UNO can't but Mega -can- do full 8-bit parallel and address external RAM directly.