DigitalWrite()
From Microduino Wiki
void digitalWrite (uint8_t pin, uint8_t value)
Write the digital pin.
Write the digital pin, corresponding to the high and low level of the pin. Before writing the pin, you need to set the mode of the pin as OUTPUT.
- Parameter:
pin number of the pin
value HIGH or LOW
- Example:
int ledPin = 13; // LED connected to digital pin 13 void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(ledPin, HIGH); //Light LED delay(1000); // Wait for 1s digitalWrite(ledPin, LOW); // switch off delay(1000); // waits for a second }
- Note:
Analog pin can be used as digital pin, and the number is from 14 (corresponding the analog pin 0) to 19 (corresponding to the analog pin 5).