Author Topic: Serial communication is not established  (Read 380 times)

harun

  • Newbie
  • *
  • Posts: 2
Serial communication is not established
« on: May 04, 2017, 07:03:55 pm »
hi, Where am I making mistakes? It does not work.

Code: [Select]
#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);
  }                         
 
}

I dont know English. Sorry if translation is faulty.