Please add delay between bits in message for slow 1-wire devices. For example, inter-bit delay is needed to program RW1990 touch memory. For example, writing new ID on such key could be as simple as
#include <OneWire.h>
OneWire ds(10);
static const byte rw1990_key[] = {0x01, 0x27, 0x4f, 0x27, 0x01, 0x00, 0x00, 0xd5};
void cmd_rw1990_write(void) {
if (!ds.reset()) {
return;
}
ds.write(0xd1);
ds.write_bit(0);
_delay_ms(10);
if (!ds.reset()) {
return;
}
ds.write(0xd5);
ds.set_bit_delay(2000);
for (uint8_t i = 0; i < 8; i++) {
ds.write(~rw1990_key[i]);
}
ds.set_bit_delay(0);
if (!ds.reset()) {
return;
}
ds.write(0xd1);
ds.write_bit(1);
_delay_ms(10);
}
Please add delay between bits in message for slow 1-wire devices. For example, inter-bit delay is needed to program RW1990 touch memory. For example, writing new ID on such key could be as simple as
(much simpler than original code at https://habr.com/ru/post/260891/ )