Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 884 Bytes

OneWire.md

File metadata and controls

29 lines (20 loc) · 884 Bytes

OneWire

  • KEYWORDS: One Wire,1-Wire,Built-In

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

  • APPEND_KEYWORD: OneWire