سلام بلی بفرمایید:
کد:int swPin = 8; // input int oldval=0; void setup() // run once, when the sketch starts { Serial.begin(9600); pinMode(swPin,INPUT); // sets the digital pin as output } void loop() // run over and over again { val=digitalRead(swPin); if(val!=oldval){ oldval=val; Serial.print("val:"); Serial.print(val); } }