-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new sensor calibrate value, mapping percent and add example some rs485
- Loading branch information
1 parent
4bfd34c
commit 7c1abe4
Showing
7 changed files
with
177 additions
and
64 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
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,26 @@ | ||
#include <Arduino.h> | ||
#include <RS485.h> //required libraries AIS_IoT_4G | ||
|
||
unsigned long time_previous = 0; // previous time for using timer with millis() | ||
void setup() | ||
{ | ||
RS485.begin(9600, SERIAL_8N1); | ||
Serial.begin(115200); | ||
} | ||
void loop() | ||
{ | ||
long temp_int16 = RS485.inputRegisterRead(1, 1); | ||
delay(50); | ||
long humi_int16 = RS485.inputRegisterRead(1, 2); | ||
|
||
float temp_float = temp_int16 / 10.0; | ||
float humi_float = humi_int16 / 10.0; | ||
|
||
Serial.print("Temperature: "); | ||
Serial.print(temp_float); | ||
Serial.print(" *C\t"); | ||
Serial.print("Humidity: "); | ||
Serial.print(humi_float); | ||
Serial.println(" %RH"); | ||
delay(2000); | ||
} |
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
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