arduino pull up resistor code example
Example 1: arduino internal pull up resistor
pinMode(2,INPUT_PULLUP);
Example 2: arduino digital input pins
int ledPin = 13;
int inPin = 7;
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(inPin, INPUT);
}
void loop() {
val = digitalRead(inPin);
digitalWrite(ledPin, val);
}
Example 3: arduino digital io pins
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Example 4: arduino internal pull up resistor
pinMode(13, OUTPUT);
Example 5: arduino internal pull up resistor
Serial.begin(9600);
Example 6: arduino internal pull up resistor
Serial.println(sensorValue, DEC);