Page 16 - S.Shafna (1B), 2207, Ass-1
P. 16

❖  Circuit
























                ❖ Arduino codes



               void setup() {
                 pinMode(2, INPUT);
                 Serial.begin(9600);

               }

               void loop() {
                 if (digitalRead(2) == HIGH);
                 Serial.println("Sensor is touched");
                 delay(500);

               }

                ❖ Output


                        •  When we touch it,  will see a "Sensor is touched" message on the
                           Serial monitor.
   11   12   13   14   15   16   17   18   19   20   21