# SFBWiring.h File Reference

SFB versions of the basic Arduino/Wiring functions. More...

`#include "SFBTypes.h"`
`#include "SFBConstants.h"`
`#include "SFBPins.h"`
`#include "lpc/timer.h"`

Include dependency graph for SFBWiring.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Functions
void | digitalWrite (int sfbPin, int value)
| Set a pin's value.
int | digitalRead (int sfbPin)
| Read a pin's value.
void | ledOn (int sfbPin)
| Turn on one of the SFB built-in LEDs.
void | ledOff (int sfbPin)
| Turn off one of the SFB built-in LEDs.
void | ledSet (int sfbPin, bool on)
| Turn on or off one of the SFB built-in LEDs.
bool | ledIsOn (int sfbPin)
| Check if one of the SFB built-in LEDs is on or off.
void | ledToggle (int sfbPin)
| Toggle one of the SFB built-in LEDs.
void | pinMode (int sfbPin, int mode)
| Set a pin's function to input or output.
u32 | isPinMode (int sfbPin, int mode)
| SFB extension: Check if a pin is currently an input or an output (or under reflex control).
void | delayMicroseconds (u32 usecondsToWait)
| Delay for some number of microseconds.
void | delayMicrosecondsApproximate (u32 usecondsToWait)
void | delay (u32 millissecondToWait)
| Delay for some number of milliseconds.
void | shiftOut (int dataPin, int clockPin, int bitOrder, u8 val)
u32 | pulseIn (int pin, int state, u32 timeoutUsec=1000000)

## Detailed Description

SFB versions of the basic Arduino/Wiring functions.

Author:
  David H. Ackley.

Date:
  (C) 2008 All rights reserved.

Code License:
  The GNU Lesser General Public License

License Note:
  All code samples shown in documentation are placed into the public domain.

## Function Documentation

void delay | ( | u32 | millissecondToWait | ) |

Delay for some number of milliseconds.

If this function is called from loop(), dispatching (i.e., running packet and alarm handlers) will occur, but if called from a packet or alarm handler, no further (recursive) dispatching will take place, and instead just the delay will happen.

Examples:
  blinky.cpp, blinky2.cpp, blinky3.cpp, blinkySync.cpp, buttonled2.cpp, eeprom2.cpp, eeprom3.cpp, eeprom4.cpp, fifthdirection.cpp, hallucination.cpp, helloworld.cpp, netled.cpp, pingpong2.cpp, profile1.cpp, profile2.cpp, profile3.cpp, qled1.cpp, reorder.cpp, sdcard1.cpp, sdcard2.cpp, sdcard3.cpp, speed1.cpp, speed2.cpp, speed3.cpp, and timer4.cpp.

void digitalWrite | ( | int | sfbPin,
|  | int | value |
| ) |  |  |

Set a pin's value.

Following the Arduino approach, this method can also be used to set the pullup resistors on input pins: If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal pullup resistor, and writing a LOW value will disable the internal pullup resistor. (As an SFB extension, it is also possible to set an internal pulldown resistor, see setPinResistor.)

Examples:
  blinky.cpp, and blinkySync.cpp.

u32 isPinMode | ( | int | sfbPin,
|  | int | mode |
| ) |  |  |

SFB extension: Check if a pin is currently an input or an output (or under reflex control).

Parameters:

  | mode | Either INPUT or OUTPUT for basic usage. Can also be REFLEX_MODE to check if a pin is in reflex mode (rather than checking if it's an input or an output).

Returns:
  Non-zero if mode is INPUT and sfbPin is currently an input pin, or if mode is OUTPUT and sfbPin is currently an output pin, or if mode is REFLEX_MODE and sfbPin is currently under reflex control; and returns 0 otherwise.

Blinks:
  E_API_ARGUMENT if mode is not INPUT, OUTPUT, or REFLEX_MODE

Blinks:
  E_API_BAD_PIN if sfbPin is not a valid pin

Since:
  0.9.11

bool ledIsOn | ( | int | sfbPin | ) | `[inline]`

Check if one of the SFB built-in LEDs is on or off.

Returns:
  `true` if the sfbPin is on, `false` otherwise

Examples:
  buttonled2.cpp.

void pinMode | ( | int | sfbPin,
|  | int | mode |
| ) |  |  |

Set a pin's function to input or output.

SFB extension: Set to 'reflex mode'.

Examples:
  blinky.cpp, and blinkySync.cpp.