Arduino, send and receive data , part 3 , get the data, and make LED Blink

August 9, 2012   ·   0 Comments


#include <SoftwareSerial.h>
SoftwareSerial myReader(2, 3); // RX, TX
// 'Setup' function
void setup()
{
  // Start the UART at 115200 baud
  Serial.begin(9600);
  myReader.begin(9600);
  
  pinMode(13, OUTPUT); 
}
void loop()
{  
  // If there is data ready...
  if (myReader.available())
  {
    // ...Set the value of our variable to whatever the data is
    int val = myReader.read();
    // Print the data back through the UART
    if(val==13){
      digitalWrite(13, HIGH);
      delay(500);
      digitalWrite(13, LOW);
    }
    Serial.println(val);
  }
}


#include <SoftwareSerial.h>
SoftwareSerial mySender(4, 5); // RX, TX
// 'Setup' function
void setup()
{
  // Start the UART at 115200 baud
  Serial.begin(9600);
  mySender.begin(9600);
}

void loop()
{  
   mySender.write(13);
 // mySender.print("how are you?");
  delay(1000);
}

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Hardware22

Hardware

Amazon

adsbygoogle

Recent Posts

Categories

Amazon