missionjnr.blogg.se

Arduino one wire library
Arduino one wire library













Here we do the basics */ void setup(void) DallasTemperature sensors(&oneWire) // arrays to hold device address DeviceAddress insideThermometer /* * Setup function.

arduino one wire library arduino one wire library

This will be the code:- // Include the libraries we need #include #include #include #include #include #include #define SCREEN_WIDTH 128 // OLED display width, in pixels #define SCREEN_HEIGHT 32 // OLED display height, in pixels #define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address 0x3D for 128圆4, 0x3C for 128x32 Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET) // Data wire is plugged into port 2 on the Arduino #define ONE_WIRE_BUS 2 // Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs) OneWire oneWire(ONE_WIRE_BUS) // Pass our oneWire reference to Dallas Temperature.















Arduino one wire library