resistive Sensor
int mySensorValue;
void setup () {
Serial.begin(9600);
}
void loop () {
mySensorValue = analogRead(A0);
Serial.print("The Sensor Value is: ");
Serial.println(mySensorValue);
}
switch or Button
int mySensorValue;
void setup () {
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(4,INPUT);
}
void loop () {
mySensorValue = digitalRead(4);
if (mySensorValue == LOW) {
Serial.println("The Button is pressed. ");
digitalWrite(13,HIGH);
}
else {
Serial.println("The Button is not pressed");
digitalWrite(13,LOW);
}
}