Chat Protocol

Hi there,

I need to send zeros and ones through output pin, question is if I can make it like in the highlighted line, will arduino be able to make it? Main idea is to make a chat protocol between two arduinos without using Rx Tx ports

const int ArdStatus = 6;
const int input = 3;
const int output = 5;

void setup()
{
Serial.begin( 9600 );
pinMode(ArdStatus, OUTPUT);
pinMode(input, INPUT);
pinMode(output, OUTPUT);
}

void loop() {

while (Serial.available())
{

String input = Serial.readString();
char binaryText[input.length() + 1] ;

input.toCharArray(binaryText, input.length() + 1);

for (int i = 0; i < input.length(); i++) {
digitalWrite(ArdStatus, HIGH);

Serial.print(binaryText*, BIN);*

  • Serial.print(" ");*
    _ digitalWrite(output, (binaryText*, BIN));_
    _
    [/color]*_

* digitalWrite(ArdStatus, LOW);*
* }*
* Serial.println();*
//further down, unimportant for now
_ char bT = binaryText;_
_
byte textBuf[ 12 ];_
_ byte text;_
_
text = textBuf;
_
_ text = 0;
while ( bT )_
_
{
_
_ Serial.print( bT );//prints the char_
_ if ( bT != ’ ’ )_
_
{
_
_ (text) = 2; // without those parens the compiler makes it (text = 2);
if ( bT == ‘1’ ) {
(text)++; // without the parens it becomes (text++);_
_
}
_
_
}
_
_
else
_
_
{_
_
text++;_
_ text = 0;_
_
}
_
* bT++;*
* }*
* Serial.println( );*
_ Serial.print((char ) textBuf );_
_
Serial.println( );_
_
}_
_
}*_

The only thing that you can output from a digital pin is a LOW state (0V) or HIGH state (5V).

digitalWrite(output, (binaryText, BIN));

What do you expect this statement to do? What do you get if you assign (binaryText, BIN) to a variable, and then print the value in the variable? Is it at all what you expected? I didn't think so.

I need to send corresponding 1 and zeros so i can catch them with another arduino and translate them again

There is no problem sending 0 or 1 and reading them with a second Arduino but you have to do it 1 bit at a time as a digitalWrite() cannot output a byte as you are attempting to do.

What have you got against using a normal serial protocol ? You do not have to use the pins marked Tx and Rx if you use SoftSerial.

biggiejr:
I need to send corresponding 1 and zeros so i can catch them with another arduino and translate them again

Did you try, as I suggested:

int x = (binaryText, BIN);
Serial.print("x = ");
Serial.println(x);

?
If not, I suggest that you go do that now. Until you understand what (binaryText, BIN) is doing, you can make no progress on your project.