Syntax
uint32_t shiftIn(
    uint32_t ulDataPin, 
    uint32_t ulClockPin, 
    uint32_t ulBitOrder
);
ContentsIndex
PreviousUpNext
shiftIn
Example
Syntax
uint32_t shiftIn(
    uint32_t ulDataPin, 
    uint32_t ulClockPin, 
    uint32_t ulBitOrder
);
Description

Reads data of a byte by bits on the assigned pin. Every bit of data is read from the data pin. You can select to combine the read 8-bit data into a byte from MSB or LSB. Every clock cycle (meaning the clock goes through a complete high voltage and low voltage) reads a bit of data; every bit of data is read when the clock signal is at high voltage.

Parameters
Parameters 
Description 
uint32_t ulDataPin 
[IN] Data input pin, for reading every bit of data 
uint32_t ulClockPin 
[IN] Clock pin. Periodically switches between high voltage and low voltage when dataPin outputs data 
uint32_t ulBitOrder 
[IN] Data input order. Can be MSBFIRST (MSB first) or LSBFIRST (LSB first) 
Returns

Data read (one byte)

Example
#define DATA  13
#define CLOCK 15
void setup()
{
    pinMode(DATA, INPUT);
    pinMode(CLOCK, OUTPUT);
}
void loop()
{
    byte data;
    data = shiftIn(DATA, CLOCK, LSBFIRST);
    delay(1000);
}
File

wiring_shift.h

Group