-
Notifications
You must be signed in to change notification settings - Fork 0
/
SimpleFirmataDHT.ino
58 lines (50 loc) · 1.87 KB
/
SimpleFirmataDHT.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Copyright (C) 2014 Nicolas Panel. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
See file LICENSE.txt for further informations on licensing terms.
*/
#include <ConfigurableFirmata.h>
#include <FirmataExt.h>
#include <FirmataReporting.h>
#include <idDHTLib.h>
#include "FirmataDHT.h"
FirmataExt firmataExt;
FirmataReporting reporting;
FirmataDHT dhtSensor;
/*==============================================================================
* FUNCTIONS
*============================================================================*/
void systemResetCallback()
{
firmataExt.reset();
}
/*==============================================================================
* SETUP()
*============================================================================*/
void setup()
{
// TODO - pass the version of this firmware rather than the Firmata protocol
// version. Making that change now however may break compatibility.
Firmata.setFirmwareVersion(FIRMATA_MAJOR_VERSION, FIRMATA_MINOR_VERSION);
firmataExt.addFeature(reporting);
firmataExt.addFeature(dhtSensor);
/* systemResetCallback is declared here (in ConfigurableFirmata.ino) */
Firmata.attach(SYSTEM_RESET, systemResetCallback);
Firmata.begin(57600);
systemResetCallback(); // reset to default config
}
/*==============================================================================
* LOOP()
*============================================================================*/
void loop()
{
/* STREAMREAD - processing incoming messages as soon as possible, while still
* checking digital inputs. */
while (Firmata.available()) {
Firmata.processInput();
}
dhtSensor.update();
}