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

❖ Arduino codes




                                   int vibrationSensor=A0;//digital pin as senseor pin
                                   int VibrationValue=0;
                                   void setup()
                                   {
                                   Serial.begin(9600);
                                   pinMode(vibrationSensor,INPUT);
                                   }
                                   void loop()
                                   {
                                   VibrationValue=analogRead(vibrationSensor);
                                   Serial.println(VibrationValue);
                                   delay(100);
                                   }




                ❖ Output


                         •  The value of the Analog signal given by the vibrate motor is printed
                             on the serial monitor with a delay of 100 millisecinds.
   32   33   34   35   36   37   38   39