0.1.2 DHT2pin

This commit is contained in:
rob tillaart 2021-12-16 13:42:53 +01:00
parent 962377b7ba
commit c3f400ba9f
10 changed files with 61 additions and 38 deletions

View File

@ -2,6 +2,10 @@ compile:
# Choosing to run compilation tests on 2 different Arduino platforms
platforms:
- uno
- leonardo
- due
- zero
# - due
# - zero
# - leonardo
- m4
- esp32
# - esp8266
# - mega2560

View File

@ -4,10 +4,14 @@ name: Arduino CI
on: [push, pull_request]
jobs:
arduino_ci:
runTest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Arduino-CI/action@master
# Arduino-CI/action@v0.1.1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- run: |
gem install arduino_ci
arduino_ci.rb

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016-2021 Rob Tillaart
Copyright (c) 2016-2022 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

View File

@ -1,19 +1,20 @@
//
// FILE: DHT2pin.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// PURPOSE: Experimental DHT Temperature & Humidity Sensor library for Arduino
// URL: https://github.com/RobTillaart/DHT2pin
// http://arduino.cc/playground/Main/DHTLib
//
// HISTORY:
// 0.1.1 2020-12-19 added arduino-ci + unit test
// 0.1.0 2020-06-30 own repository; #pragma once
// 0.0.3 Fix issue #33
// 0.0.2 support for non "F_CPU" boards especially Galileo
// Tested and verified by Maria Emanuella Moura Silva (thanks)
// changed name to DHT2pin
// 0.0.1 initial version - 2016 SEP 05 (based upon 0.1.13 DHT)
// 0.1.2 2021-12-16 update library.json, license, minor edits
// 0.1.1 2020-12-19 added arduino-ci + unit test
// 0.1.0 2020-06-30 own repository; #pragma once
// 0.0.3 Fix issue #33
// 0.0.2 support for non "F_CPU" boards especially Galileo
// Tested and verified by Maria Emanuella Moura Silva (thanks)
// changed name to DHT2pin
// 0.0.1 initial version - 2016 SEP 05 (based upon 0.1.13 DHT)
//
#include "DHT2pin.h"

View File

@ -2,7 +2,7 @@
//
// FILE: dht2pin.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.1.2
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: https://github.com/RobTillaart/DHT2pin
// http://arduino.cc/playground/Main/DHTLib
@ -13,15 +13,15 @@
#include <Arduino.h>
#define DHT2PIN_LIB_VERSION "0.1.1"
#define DHT2PIN_LIB_VERSION (F("0.1.2"))
#define DHTLIB_OK 0
#define DHTLIB_ERROR_CHECKSUM -1
#define DHTLIB_ERROR_TIMEOUT -2
#define DHTLIB_ERROR_CONNECT -3
#define DHTLIB_ERROR_ACK_L -4
#define DHTLIB_ERROR_ACK_H -5
#define DHTLIB_INVALID_VALUE -999
#define DHTLIB_OK 0
#define DHTLIB_ERROR_CHECKSUM -1
#define DHTLIB_ERROR_TIMEOUT -2
#define DHTLIB_ERROR_CONNECT -3
#define DHTLIB_ERROR_ACK_L -4
#define DHTLIB_ERROR_ACK_H -5
#define DHTLIB_INVALID_VALUE -999
#define DHTLIB_DHT11_WAKEUP 18
#define DHTLIB_DHT_WAKEUP 1
@ -36,7 +36,7 @@
#else
#define DHTLIB_TIMEOUT (75000000/40000)
#endif
class DHT2pin
{
public:
@ -44,8 +44,8 @@ public:
// DHTLIB_OK
// DHTLIB_ERROR_CHECKSUM
// DHTLIB_ERROR_TIMEOUT
DHT2pin(uint8_t rpin, uint8_t wpin)
{
DHT2pin(uint8_t rpin, uint8_t wpin)
{
_rpin = rpin;
_wpin = wpin;
temperature = 0;
@ -57,7 +57,7 @@ public:
pinMode(_rpin, INPUT);
pinMode(_wpin, OUTPUT);
}
int read11();
int read();

View File

@ -1,6 +1,6 @@
# Syntax Coloring Map For DHT2pin
# Syntax Colouring Map For DHT2pin
# Datatypes (KEYWORD1)
# Data types (KEYWORD1)
DHT2pin KEYWORD1
@ -18,6 +18,7 @@ temperature KEYWORD2
# Constants (LITERAL1)
DHT2PIN_LIB_VERSION LITERAL1
DHTLIB_OK LITERAL1
DHTLIB_ERROR_CHECKSUM LITERAL1
DHTLIB_ERROR_TIMEOUT LITERAL1

View File

@ -15,8 +15,9 @@
"type": "git",
"url": "https://github.com/RobTillaart/DHT2pin"
},
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*"
"platforms": "*",
"headers": "DHT2pin.h"
}

View File

@ -1,5 +1,5 @@
name=DHT2pin
version=0.1.1
version=0.1.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Experimental library of the DHT library that uses 2 pins.

View File

@ -1,12 +1,15 @@
[![Arduino CI](https://github.com/RobTillaart/DHT2pin/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
[![Arduino-lint](https://github.com/RobTillaart/DHT2pin/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DHT2pin/actions/workflows/arduino-lint.yml)
[![JSON check](https://github.com/RobTillaart/DHT2pin/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DHT2pin/actions/workflows/jsoncheck.yml)
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DHT2pin/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/release/RobTillaart/DHT2pin.svg?maxAge=3600)](https://github.com/RobTillaart/DHT2pin/releases)
# DHT2pin
Arduino library for experimental 2 pin DHT library
Arduino library for experimental 2 pin DHT library.
## Description
@ -17,10 +20,10 @@ One pin for all read actions and one pin for write actions. This way one does
not need to switch a pin between **INPUT** and **OUTPUT**.
Note: It needs a diode in the hardware between the input pin of the MCU
and the datapin of the DHT sensor.
The output pin of the MCU is directly connected to the datapin of the DHT sensor.
and the data pin of the DHT sensor.
The output pin of the MCU is directly connected to the data pin of the DHT sensor.
It was made after a request which also refered to the links below.
It was made after a request which also referred to the links below.
https://communities.intel.com/thread/53869
@ -30,12 +33,20 @@ http://bigdinotech.com/tutorials/galileo-tutorials/using-1-wire-device-with-inte
**NOTE: THIS LIB IS NOT TESTED EXTENSIVELY YET SO USE WITH CARE**
## Credits & testing
Maria Emanuella Moura Silva for testing and verifying this experimental
code on a Galileo.
## Operation
See examples
## Future
- no active development planned
- improve unit tests (constants)
-

View File

@ -31,6 +31,7 @@
unittest_setup()
{
fprintf(stderr, "DHT2PIN_LIB_VERSION: %s\n", (char *) DHT2PIN_LIB_VERSION);
}
unittest_teardown()
@ -41,7 +42,7 @@ unittest_teardown()
unittest(test_constructor)
{
DHT2pin DHT(2, 3);
fprintf(stderr, DHT2PIN_LIB_VERSION);
assertEqualFloat(0, DHT.temperature, 0.001);
assertEqualFloat(0, DHT.humidity, 0.001);