A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://docs.leaflabs.com/static.leaflabs.com/pub/leaflabs/maple-docs/latest/lang/api/pinmode.html below:

pinMode() — Maple v0.0.12 Documentation

pinMode()¶ Library Documentation¶

Configure behavior of a GPIO pin.

Parameters: See:

WiringPinMode

WiringPinMode enum

Specifies a GPIO pin behavior.

Values:

Discussion¶

pinMode() is usually called within setup() in order to configure a pin for a certain usage (although it may be called anywhere).

Example¶

This example uses pinMode() to set up the pin connected to the built-in LED as an output. Once this is done, digitalWrite() can be used to turn the pin HIGH and LOW, which turn the LED on and off.

void setup() {
    pinMode(BOARD_LED_PIN, OUTPUT);      // sets the LED pin as output
}

void loop() {
    digitalWrite(BOARD_LED_PIN, HIGH);   // sets the LED on
    delay(1000);                         // waits for a second
    digitalWrite(BOARD_LED_PIN, LOW);    // sets the LED off
    delay(1000);                         // waits for a second
}
Arduino Compatibility¶

On Maple, pinMode() supports the INPUT and OUTPUT modes in the same way as Arduino (however, remember that the Maple, as a 3.3V device, will only drive 3.3V to an OUTPUT pin that has been set HIGH, instead of 5V like on Arduino).

INPUT_ANALOG and PWM modes were added because the Maple doesn’t separate the analog and digital pins the same way Arduino does. Unlike on Arduino, you must call pinMode() to set up a pin for these purposes before a call to, e.g., analogRead(). This should only add a few lines to your setup() function.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4