General Discussion > Other Arduino Talk

Serial communication is not established

(1/1)

harun:
hi, Where am I making mistakes? It does not work.


--- Code: ---#include <SoftSerial.h>
#include <TinyPinChange.h>

SoftSerial mySerial(2, 3);

char data = 0;
void setup()
{
  Serial.begin(9600);
  pinMode(1, OUTPUT);
}

void loop()
{
  if(Serial.available() > 0)
  {
    data = Serial.read();
    Serial.print(data);
    Serial.print("\n");
    if(data == '1')
      digitalWrite(1, HIGH);
    else if(data == '0')
      digitalWrite(1, LOW);
  }                         
 
}
--- End code ---

I dont know English. Sorry if translation is faulty.

Amaury:
What microcontroller are you using? With what OS?
By the code i think u are just trying to send data from microcontroller to another microcontroller and check if you receive the same data.
You have to give more information if you want answers.

Navigation

[0] Message Index

Go to full version