print buffer text and hex format

This commit is contained in:
Harald Pichler 2017-02-01 16:17:48 +01:00
parent 6a9b6ae77b
commit 201a8174c6
2 changed files with 8 additions and 8 deletions

View file

@ -38,10 +38,7 @@
#define SICSLOWPAN_CONF_FRAG 1
#define LOOP_INTERVAL (10 * CLOCK_SECOND)
/* Save energy */
//#define RDC_CONF_PT_YIELD_OFF
#define LOOP_INTERVAL (15 * CLOCK_SECOND)
/* For Debug: Dont allow MCU sleeping between channel checks */
//#undef RDC_CONF_MCU_SLEEP

View file

@ -54,8 +54,6 @@ void loop (void)
{
byte buffer[32]; // Holds one page of data
int status;
mcu_sleep_off();
// Search for the first compatible EPROM/EEPROM on the bus.
// If you have multiple devices you can use de.setAddress()
@ -84,7 +82,14 @@ void loop (void)
// Read the first page of memory into buffer
if ((status = de.readPage(buffer, 0)) == 0) {
Serial1.println("Text:");
Serial1.println((char*)buffer);
Serial1.println("Hex:");
for(int i = 0; i < 32; i++) {
Serial1.print(buffer[i], HEX);
Serial1.print(" ");
}
Serial1.println("");
} else {
sprintf((char*)buffer, "Error reading page! Code: %d", status);
Serial1.println((char*)buffer);
@ -94,6 +99,4 @@ void loop (void)
}
}
Serial1.println("");
mcu_sleep_on();
}