Created
December 13, 2012 11:04
-
-
Save korayal/4275766 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
Serial.begin(9600); | |
//buradan sonrası sadece Mega'lar için geçerli | |
//Serial1.begin(19200); | |
//Serial2.begin(38400); | |
//Serial3.begin(4800); | |
} | |
void loop() { | |
String Seri; | |
if ((Seri = SeriOku(Serial)) != "") Serial.println(Seri); | |
//buradan sonrası sadece Mega'lar için geçerli | |
// if ((Seri = SeriOku(Serial1)) != "") Serial.println(Seri); | |
// if ((Seri = SeriOku(Serial2)) != "") Serial.println(Seri); | |
// if ((Seri = SeriOku(Serial3)) != "") Serial.println(Seri); | |
//burası kullandığınız baud rate e göre değişiklik gösterecektir | |
delay(200); | |
} | |
String SeriOku(HardwareSerial SeriPort) { | |
String SeriString = ""; | |
char SeriByte[1]; | |
// bağlanacağımız SeriPort'ta okunacak veri olduğu sürece | |
// 1 Byte'lık bir karakter okuyup bunu stringe ekleyelim | |
while (SeriPort.available()) SeriString += (SeriByte[0] = SeriPort.read()); | |
return SeriString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment