43 lines
822 B
Arduino
43 lines
822 B
Arduino
/*!
|
|
serial_output_readable.ino
|
|
|
|
v20210423: Initial version
|
|
v20210424: 0x0000 reading shown as 0000 instead of 0
|
|
*/
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <ER1400.h>
|
|
#define PIN_CLK 2
|
|
#define PIN_C1 3
|
|
#define PIN_C2 4
|
|
#define PIN_C3 5
|
|
#define PIN_OUT 6
|
|
#define PIN_IN 7
|
|
ER1400 er1400(PIN_CLK, PIN_C1, PIN_C2, PIN_C3, PIN_OUT, PIN_IN);
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
int i;
|
|
char j[4];
|
|
char dataOut[4];
|
|
for (i = 0; i < 100; i++) {
|
|
if ( (i % 8) == 0) {
|
|
sprintf(j, "%04X", i);
|
|
Serial.print(j);
|
|
Serial.print(": ");
|
|
}
|
|
sprintf(dataOut, "%04X", er1400.readData(i), HEX);
|
|
Serial.print(dataOut);
|
|
if ( ( (i + 1) % 8) == 0) {
|
|
Serial.println("");
|
|
} else {
|
|
Serial.print(" ");
|
|
}
|
|
}
|
|
Serial.println("");
|
|
}
|
|
|
|
void loop() {
|
|
}
|