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.

Navigation

[0] Message Index

Go to full version