Arduino-GPIO
General Purpose Input/Output (GPIO) library for Arduino
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
ShiftIn.ino
Go to the documentation of this file.
1
#include "GPIO.h"
2
#include "
SRPI.h
"
3
#include "
benchmark.h
"
4
5
SRPI<LSBFIRST, BOARD::D12, BOARD::D13>
srpi
;
6
#define DATA_PIN 12
7
#define CLOCK_PIN 13
8
9
void
setup
()
10
{
11
Serial
.begin(57600);
12
while
(!
Serial
);
13
14
// Set pin mode
15
pinMode(
DATA_PIN
, INPUT);
16
pinMode(
CLOCK_PIN
, OUTPUT);
17
18
// Set benchmark baseline
19
BENCHMARK_BASELINE
(1000);
20
}
21
22
void
loop
()
23
{
24
uint8_t value;
25
26
BENCHMARK
(
"1. Arduino core shiftIn"
, 1000) {
27
value = shiftIn(
DATA_PIN
,
CLOCK_PIN
, LSBFIRST);
28
}
29
30
BENCHMARK
(
"2. SRPI input operator"
, 1000) {
31
srpi >> value;
32
}
33
34
Serial
.println();
35
delay(2000);
36
}
SRPI
Definition:
SRPI.h:31
CLOCK_PIN
#define CLOCK_PIN
Definition:
ShiftIn.ino:7
Serial
Software::Serial< BOARD::D0 > Serial
Definition:
ShiftIn.ino:6
srpi
SRPI< LSBFIRST, BOARD::D1, BOARD::D2 > srpi
Definition:
ShiftIn.ino:7
loop
void loop()
Definition:
ShiftIn.ino:24
SRPI.h
BENCHMARK
#define BENCHMARK(msg, scale)
Definition:
benchmark.h:52
BENCHMARK_BASELINE
#define BENCHMARK_BASELINE(scale)
Definition:
benchmark.h:34
benchmark.h
DATA_PIN
#define DATA_PIN
Definition:
ShiftIn.ino:6
setup
void setup()
Definition:
ShiftIn.ino:11
examples
ShiftIn
ShiftIn.ino
Generated on Sat Oct 14 2017 16:03:22 for Arduino-GPIO by
1.8.11