Koduino
Functions
Digital I/O

Detailed Description

Usage

  1. Call pinMode() to set the pin to OUTPUT, OUTPUT_OPEN_DRAIN, INPUT, INPUT_PULLUP, or INPUT_PULLDOWN
  2. Call digitalWrite() with HIGH, LOW or TOGGLE on output pins
  3. Call digitalRead() on input pins

Example: Blink

#include <Arduino.h>
// Change to whatever pin an LED is connected to
const int led = PC13;
void setup() {
pinMode(led, OUTPUT);
}
void loop() {
digitalWrite(led, TOGGLE);
delay(1000);
}
Authors
Avik De avikd.nosp@m.e@gm.nosp@m.ail.c.nosp@m.om

This file is part of koduino https://github.com/avikde/koduino

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, see http://www.gnu.org/licenses/.

Functions

void digitalWrite (uint8_t pin, LogicValue val)
 Set a digital pin to a given logic level. More...
 
static uint8_t digitalRead (uint8_t pin) __attribute__((always_inline
 Read a digital pin. More...
 

Function Documentation

static uint8_t digitalRead ( uint8_t  pin)
inlinestatic

Read a digital pin.

Pin must have been configured as input by pinMode()

Parameters
pinPin to read
Returns
1 if the pin is a logic HIGH level, 0 for LOW
void digitalWrite ( uint8_t  name,
LogicValue  val 
)

Set a digital pin to a given logic level.

[long description]

Parameters
pinPin to set
valCan be LOW, HIGH, or TOGGLE (new from Arduino)
Authors
Avik De avikd.nosp@m.e@gm.nosp@m.ail.c.nosp@m.om

This file is part of koduino https://github.com/avikde/koduino

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, see http://www.gnu.org/licenses/.