mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.3.2 DS18B20_INT
This commit is contained in:
parent
9e09cca8ef
commit
7ea5521760
@ -6,10 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.3.2] - 2024-01-03
|
||||
- fix examples
|
||||
- minor edits
|
||||
|
||||
|
||||
## [0.3.1] - 2023-10-19
|
||||
- update readme.md
|
||||
|
||||
|
||||
## [0.3.0] - 2023-03-05
|
||||
- fix #15 infinite loop
|
||||
- move sources to src folder to comply with PlatformIO dependency system.
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017-2023 Rob Tillaart
|
||||
Copyright (c) 2017-2024 Rob Tillaart
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
@ -65,7 +65,7 @@ or -127 = DEVICE_DISCONNECTED
|
||||
#### CentiC part
|
||||
|
||||
The following functions are experimental since 0.2.0 and not tested a lot by me.
|
||||
They allow to use a higher resolution while not using floats.
|
||||
They allow to use a higher resolution while **not using floats**.
|
||||
Goal is to keep the footprint of the library small.
|
||||
|
||||
- **bool setResolution(uint8_t resolution = 9)** sets the internal resolution to 9, 10, 11 or 12 bits.
|
||||
@ -148,7 +148,7 @@ Measured with DS18B20_performance.ino
|
||||
## Credits
|
||||
|
||||
Miles Burton who originally developed the Arduino Temperature Control Library.
|
||||
and all people who contributed to that lib.
|
||||
and all people who contributed to that library.
|
||||
|
||||
|
||||
## Future
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "DS18B20_INT.h"
|
||||
|
||||
|
||||
#define ONE_WIRE_BUS 2
|
||||
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
@ -45,4 +46,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -7,11 +7,13 @@
|
||||
|
||||
#include "DS18B20_INT.h"
|
||||
|
||||
|
||||
#define ONE_WIRE_BUS 2
|
||||
|
||||
OneWire oneWire(ONE_WIRE_BUS);
|
||||
DS18B20_INT sensor(&oneWire);
|
||||
|
||||
|
||||
uint32_t start, stop;
|
||||
|
||||
|
||||
@ -47,4 +49,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -4,8 +4,8 @@
|
||||
// PURPOSE: DS18B20 lib getAddress demo
|
||||
// URL: https://github.com/RobTillaart/DS18B20_INT
|
||||
|
||||
#include <OneWire.h>
|
||||
#include <DS18B20_INT.h>
|
||||
|
||||
#include "DS18B20_INT.h"
|
||||
|
||||
|
||||
#define ONE_WIRE_BUS 2
|
||||
@ -52,5 +52,5 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -37,5 +37,5 @@ void loop(void)
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -5,8 +5,7 @@
|
||||
// URL: https://github.com/RobTillaart/DS18B20_INT
|
||||
|
||||
|
||||
#include <OneWire.h>
|
||||
#include <DS18B20_INT.h>
|
||||
#include "DS18B20_INT.h"
|
||||
|
||||
|
||||
#define ONE_WIRE_BUS 2
|
||||
@ -16,6 +15,7 @@ DS18B20_INT sensor(&oneWire);
|
||||
|
||||
DeviceAddress da;
|
||||
|
||||
|
||||
uint32_t start, stop;
|
||||
|
||||
|
||||
@ -105,4 +105,4 @@ void loop()
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
@ -5,8 +5,7 @@
|
||||
// URL: https://github.com/RobTillaart/DS18B20_INT
|
||||
|
||||
|
||||
#include <OneWire.h>
|
||||
#include <DS18B20_INT.h>
|
||||
#include "DS18B20_INT.h"
|
||||
|
||||
|
||||
#define ONE_WIRE_BUS 2
|
||||
@ -33,12 +32,16 @@ void loop(void)
|
||||
{
|
||||
sensor.requestTemperatures();
|
||||
|
||||
while (!sensor.isConversionComplete()); // (BLOCKING!!) wait until sensor is ready
|
||||
// BLOCKING!! blocks until sensor is ready
|
||||
while (!sensor.isConversionComplete())
|
||||
{
|
||||
delay(1);
|
||||
}
|
||||
|
||||
Serial.print("Temp: ");
|
||||
Serial.println(sensor.getTempC());
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -27,25 +27,7 @@ const int startPin = 2;
|
||||
const int endPin = 20;
|
||||
|
||||
|
||||
#include <OneWire.h>
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println("//\n// Start oneWireSearch.ino \n//");
|
||||
|
||||
for (uint8_t pin = startPin; pin < endPin; pin++)
|
||||
{
|
||||
findDevices(pin);
|
||||
}
|
||||
Serial.println("\n//\n// End oneWireSearch.ino \n//");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
#include "OneWire.h"
|
||||
|
||||
|
||||
uint8_t findDevices(int pin)
|
||||
@ -92,5 +74,25 @@ uint8_t findDevices(int pin)
|
||||
}
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.println("//\n// Start oneWireSearch.ino \n//");
|
||||
|
||||
for (uint8_t pin = startPin; pin < endPin; pin++)
|
||||
{
|
||||
findDevices(pin);
|
||||
}
|
||||
Serial.println("\n//\n// End oneWireSearch.ino \n//");
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
"version": "^2.3.5"
|
||||
}
|
||||
],
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"license": "MIT",
|
||||
"frameworks": "*",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=DS18B20_int
|
||||
version=0.3.1
|
||||
version=0.3.2
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Library for DS18B20 restricted to a single sensor per pin.
|
||||
|
@ -1,9 +1,9 @@
|
||||
//
|
||||
// FILE: DS18B20_INT.cpp
|
||||
// AUTHOR: Rob.Tillaart@gmail.com
|
||||
// VERSION: 0.3.1
|
||||
// AUTHOR: Rob.Tillaart
|
||||
// VERSION: 0.3.2
|
||||
// DATE: 2017-07-25
|
||||
// PUPROSE: library for DS18B20 temperature sensor - integer only.
|
||||
// PURPOSE: library for DS18B20 temperature sensor - integer only.
|
||||
// URL: https://github.com/RobTillaart/DS18B20_INT
|
||||
// https://github.com/RobTillaart/DS18B20_RT
|
||||
|
||||
@ -88,7 +88,7 @@ int16_t DS18B20_INT::getTempC(void)
|
||||
}
|
||||
|
||||
|
||||
bool DS18B20_INT::getAddress(uint8_t* buf)
|
||||
bool DS18B20_INT::getAddress(uint8_t * buf)
|
||||
{
|
||||
if (_addressFound)
|
||||
{
|
||||
@ -146,6 +146,7 @@ int16_t DS18B20_INT::_readRaw(void)
|
||||
_oneWire->reset();
|
||||
_oneWire->select(_deviceAddress);
|
||||
_oneWire->write(READSCRATCH);
|
||||
|
||||
int16_t rawTemperature = ((int16_t)_oneWire->read());
|
||||
rawTemperature |= _oneWire->read() << 8;
|
||||
_oneWire->reset();
|
||||
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
//
|
||||
// FILE: DS18B20_INT.h
|
||||
// AUTHOR: Rob.Tillaart@gmail.com
|
||||
// VERSION: 0.3.1
|
||||
// AUTHOR: Rob.Tillaart
|
||||
// VERSION: 0.3.2
|
||||
// DATE: 2017-07-25
|
||||
// PUPROSE: Minimalistic library for DS18B20 temperature sensor
|
||||
// PURPOSE: Minimalistic library for DS18B20 temperature sensor
|
||||
// uses only integer math (no float to minimize footprint)
|
||||
// URL: https://github.com/RobTillaart/DS18B20_INT
|
||||
// https://github.com/RobTillaart/DS18B20_RT
|
||||
@ -21,11 +21,12 @@
|
||||
//
|
||||
|
||||
|
||||
#define DS18B20_INT_LIB_VERSION (F("0.3.1"))
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "OneWire.h"
|
||||
|
||||
|
||||
#define DS18B20_INT_LIB_VERSION (F("0.3.2"))
|
||||
|
||||
// Error Code
|
||||
#define DEVICE_DISCONNECTED -127
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user