arduino pin code example
Example 1: 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 2: arduino digital io pins
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Example 3: arduino internal pull up resistor
Serial.begin(9600);
Example 4: arduino pullup
pinMode(pin, INPUT);
digitalWrite(pin, HIGH);