arduino digitalwrite code example
Example 1: digitalwrite C++
digitalWrite(pin, value)
Example 2: arduino pinmode
void setup() {
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
Example 3: arduino digital read
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 4: arduino code analogwrite
analogWrite(Pin number here,0 - 255 value here);
Example 5: arduino digitalwrite
digitalWrite(pin number, LOW/HIGH)