1. Displacement output function (8-bit)
When the value data is entered, the Arduino automatically assigns the data movement to 8 parallel outputs. Where Datapin is the pin number of the connection DS, Clockpin is the pin number of the connection SH_CP, the Bitorder is to set the data displacement order, respectively, high-first-entry msbfirst or low-first-in Lsbfirst.
//*********************************************************************************************//function name: void Shiftout (uint8_t datapin, uint8_t clockpin, uint8_t Bitorder, byte val)//input parameters: PIN data pin//Clock Clocks//Bitorder shift sequence Msbfirst or Lsbfirst//Val Data//function return: none//function Function: Displacement output function//*********************************************************************************************voidShiftout (uint8_t datapin, uint8_t clockpin, uint8_t Bitorder,byteVal);
2. Read Pulse
The pulse of the read pin, the pulse can be high or low, if it is higher, the function is first set to the highest level, and then the timing, wait until the low level, the length of the pulse returned, in milliseconds, if the timeout has not read to the lower level, return 0.
//*********************************************************************************************//function Name: unsigned long Pulsein (uint8_t pin, uint8_t state, unsigned long timeout)//input parameters: Pin PIN number//State Pulse Status//Timeout time-out//function return: Duration//function function: Read pulse//*********************************************************************************************UnsignedLongPulsein (uint8_t pin, uint8_t state, unsignedLongTimeout);
ARDUINO101 Study Notes (vi)--Advanced IO