in

Serial Communication in Arduino in Tamil

AmountPart Type
1Red (633nm) LED
1Arduino Uno (Rev3) – ICSP
1220Ω Resistor
void setup() {   
Serial.begin(9600);   
pinMode(2, OUTPUT); 
} 
void loop() {
   if (Serial.available()) { 
    char c = Serial.read();

     if (c == '1') {
       digitalWrite(2, HIGH);
     }
 else if (c == '0') {
       digitalWrite(2, LOW);
     }     
if(digitalRead(2)==HIGH){
       Serial.println("LED ON");
       }
else{
         Serial.println("LED OFF");
         }
        }
 }

Written by Admin

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

GIPHY App Key not set. Please check settings

Data Types (தரவு வகைகள்) in Arduino

Arduino – i/o functions