51 lines
927 B
Arduino
51 lines
927 B
Arduino
/*************************************
|
|
* arduino-library-er1400
|
|
* Author: Michel Bats
|
|
* Website: www.batssoft.nl
|
|
* File name: serial_output_readable.ino
|
|
*************************************/
|
|
|
|
#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()
|
|
{
|
|
}
|