RTduino Source Code Reference Manual
Functions
I/O

Advanced input and output functions. More...

Functions

unsigned long pulseIn (uint8_t pin, uint8_t state, unsigned long timeout)
 Measures the duration of a pulse (in us) on the specified pin. More...
 
unsigned long pulseInLong (uint8_t pin, uint8_t state, unsigned long timeout)
 Measures the duration of a pulse (in us) on the specified pin. More...
 
void shiftOut (uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val)
 Sends out a byte of data on the specified data pin using the specified clock and bit order. More...
 
uint8_t shiftIn (uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder)
 Shifts in data on a specified data pin using a specified clock pin and bit order. More...
 

Detailed Description

Advanced input and output functions.

Function Documentation

◆ pulseIn()

unsigned long pulseIn ( uint8_t  pin,
uint8_t  state,
unsigned long  timeout 
)

Measures the duration of a pulse (in us) on the specified pin.

/

The state parameter specifies the type of pulse to measure (HIGH or LOW). The timeout parameter specifies the maximum time to wait for the pulse to complete. This function works on pulses from 2-3 microseconds to 3 minutes in length. It cannot work in noInterrupt() context.

Parameters
pinThe pin number to measure the pulse on.
stateThe type of pulse to measure (HIGH or LOW).
timeoutThe maximum time to wait for the pulse to complete, in microseconds.
Returns
The duration of the pulse in microseconds, or 0 if no pulse starts before the timeout.
See also
https://www.arduino.cc/reference/en/language/functions/advanced-io/pulsein

◆ pulseInLong()

unsigned long pulseInLong ( uint8_t  pin,
uint8_t  state,
unsigned long  timeout 
)

Measures the duration of a pulse (in us) on the specified pin.

/

The state parameter specifies the type of pulse to measure (HIGH or LOW). The timeout parameter specifies the maximum time to wait for the pulse to complete. This function works on pulses from 2-3 microseconds to 3 minutes in length. It relies on the micros() function, so it cannot be used in noInterrupt() context.

Parameters
pinThe pin number to measure the pulse on.
stateThe type of pulse to measure (HIGH or LOW).
timeoutThe maximum time to wait for the pulse to complete, in microseconds.
Returns
The duration of the pulse in microseconds, or 0 if no pulse starts before the timeout.
See also
https://www.arduino.cc/reference/en/language/functions/advanced-io/pulseinlong

◆ shiftIn()

uint8_t shiftIn ( uint8_t  dataPin,
uint8_t  clockPin,
uint8_t  bitOrder 
)

Shifts in data on a specified data pin using a specified clock pin and bit order.

/

Parameters
dataPinThe pin on which to read the incoming data.
clockPinThe pin to toggle to signal the sending device that the Arduino is ready to receive the next bit.
bitOrderThe order in which to receive the bits (LSBFIRST or MSBFIRST).
Returns
The received data byte.
See also
https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftin

◆ shiftOut()

void shiftOut ( uint8_t  dataPin,
uint8_t  clockPin,
uint8_t  bitOrder,
uint8_t  val 
)

Sends out a byte of data on the specified data pin using the specified clock and bit order.

/

Parameters
dataPinThe pin on which to output the data.
clockPinThe pin to toggle to signal the receiving device that the data is ready.
bitOrderThe order in which to send the bits (LSBFIRST or MSBFIRST).
valThe data byte to send.
See also
https://www.arduino.cc/reference/en/language/functions/advanced-io/shiftout