Created
March 16, 2015 20:51
-
-
Save yakutozcan/d1807faa6d104ba3a66e to your computer and use it in GitHub Desktop.
ArduinoLed
This file contains hidden or 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
int led = 13; //Led pin tanımlanıyor. En kullanılabilir led piniymiş GND ye yakın olmasından galiba :D | |
int gelen; | |
void setup() { | |
pinMode(led, OUTPUT); | |
Serial.begin(9600); // 9600 Baud ile haberleşmeye başla | |
} | |
void loop() { | |
if(Serial.available()>0){ // Haberleşme kullanılabilir durumda ise | |
gelen=Serial.read(); // Java kodundan geleni oku | |
if(gelen==1) digitalWrite(led, HIGH); // 1 ise yak | |
if(gelen==0)digitalWrite(led, LOW); // 0 ise söndür | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment