Demo program for MAXREFDES132. Searches 1-Wire® bus and prints ROM IDs of devices found. If the DS1920 is found presents user with menu for interfacing with the DS1920 temperature iButton
Dependencies: OneWire Terminal mbed
Diff: main.cpp
- Revision:
- 12:a649f4e955a4
- Parent:
- 11:11a01dc7a2c9
--- a/main.cpp Mon Jul 10 17:58:11 2017 +0000 +++ b/main.cpp Mon Jul 10 23:02:11 2017 +0000 @@ -126,21 +126,11 @@ void print_rom_id(Terminal & term, const RomId & romId) { //print the rom number - term.printf("\n"); - int8_t idx = (RomId::byteLen - 1); - do - { - if(romId[idx] < 16) - { - term.printf("0x0%x ", romId[idx--]); - } - else - { - term.printf("0x%2x ", romId[idx--]); - } + term.printf("\r\n"); + for(int idx = 7; idx >= 0; idx--) { + term.printf("0x%02x ", romId.buffer[idx]); } - while(idx >= 0); - term.printf("\n"); + term.printf("\r\n"); }