This repository has been archived by the owner on Apr 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
183 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// работа в режиме шины - несколько датчиков на линии, один объект | ||
// количество датчиков для удобства | ||
#define SENS_AMOUNT 5 | ||
|
||
// создаём двухмерный массив с адресами | ||
uint8_t addr[][8] = { | ||
{0x28, 0xFF, 0x78, 0x5B, 0x50, 0x17, 0x4, 0xCF}, | ||
{0x28, 0xFF, 0x99, 0x80, 0x50, 0x17, 0x4, 0x4D}, | ||
{0x28, 0xFF, 0x53, 0xE5, 0x50, 0x17, 0x4, 0xC3}, | ||
{0x28, 0xFF, 0x42, 0x5A, 0x51, 0x17, 0x4, 0xD2}, | ||
{0x28, 0xFF, 0xCD, 0x59, 0x51, 0x17, 0x4, 0xFE}, | ||
}; | ||
|
||
#include <microDS18B20.h> | ||
MicroDS18B20<D2, DS_ADDR_MODE, SENS_AMOUNT> sensors; | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
// устанавливаем адреса | ||
sensors.setAddress((uint8_t*)addr); | ||
|
||
// Установить разрешение 9-12 бит у всех датчиков на линии | ||
//sensors.setResolutionAll(10); | ||
} | ||
|
||
void loop() { | ||
// конструкция программного таймера на 1c | ||
static uint32_t tmr; | ||
if (millis() - tmr >= 1000) { | ||
tmr = millis(); | ||
|
||
// выводим показания в порт | ||
for (int i = 0; i < SENS_AMOUNT; i++) { | ||
Serial.print(sensors.getTemp(i)); | ||
Serial.print(','); | ||
} | ||
Serial.println(); | ||
|
||
// запрашиваем новые | ||
sensors.requestTempAll(); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
examples/async_read_many_bus_pgm/async_read_many_bus_pgm.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// работа в режиме шины - несколько датчиков на линии, один объект | ||
// количество датчиков для удобства | ||
#define SENS_AMOUNT 5 | ||
|
||
// создаём двухмерный массив с адресами | ||
const uint8_t addr[][8] PROGMEM = { | ||
{0x28, 0xFF, 0x78, 0x5B, 0x50, 0x17, 0x4, 0xCF}, | ||
{0x28, 0xFF, 0x99, 0x80, 0x50, 0x17, 0x4, 0x4D}, | ||
{0x28, 0xFF, 0x53, 0xE5, 0x50, 0x17, 0x4, 0xC3}, | ||
{0x28, 0xFF, 0x42, 0x5A, 0x51, 0x17, 0x4, 0xD2}, | ||
{0x28, 0xFF, 0xCD, 0x59, 0x51, 0x17, 0x4, 0xFE}, | ||
}; | ||
|
||
#include <microDS18B20.h> | ||
MicroDS18B20<D2, DS_ADDR_MODE, SENS_AMOUNT, DS_PROGMEM> sensors; | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
// устанавливаем адреса | ||
sensors.setAddress((uint8_t*)addr); | ||
|
||
// Установить разрешение 9-12 бит у всех датчиков на линии | ||
//sensors.setResolutionAll(10); | ||
} | ||
|
||
void loop() { | ||
// конструкция программного таймера на 1c | ||
static uint32_t tmr; | ||
if (millis() - tmr >= 1000) { | ||
tmr = millis(); | ||
|
||
// выводим показания в порт | ||
for (int i = 0; i < SENS_AMOUNT; i++) { | ||
Serial.print(sensors.getTemp(i)); | ||
Serial.print(','); | ||
} | ||
Serial.println(); | ||
|
||
// запрашиваем новые | ||
sensors.requestTempAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=microDS18B20 | ||
version=3.8 | ||
version=3.9 | ||
author=AlexGyver <[email protected]> | ||
maintainer=AlexGyver <[email protected]> | ||
sentence=Light library for DS18b20 sensor | ||
|
Oops, something went wrong.