OneWire

OneWire Class in the Reference.

Espruino's 1-Wire API is designed to be similar to Arduino's OneWire library. Simply instantiate it with the pin to use, search for devices, and start communicating:

var ow = new OneWire(pin); 
device = ow.search()[0]; // search returns an array of device IDs
if (device===undefined) print("No OneWire devices found");
ow.reset();
ow.select(device); 
ow.write(42);
var result = ow.read()

Note: OneWire devices need a 4.7kOhm pullup resistor on the data line in order to work correctly.

For examples of use, look in the source code for libraries that use OneWire...

OneWire

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.