int buzr =12; int dc=13; void setup() { // put your setup code here, to run once: Serial.begin(9600); pinMode(dc, OUTPUT); } void loop() { // put your main code here, to run repeatedly: int val=Serial.read(); if(val=='1'){ digitalWrite(dc, HIGH); } else if (val=='0'){ digitalWrite(buzr,LOW); } }