Browse Source

Merge branch 'nano-revision-2.0' into nano-revision-2.1

nano-6
Stephan Richter 4 months ago
parent
commit
44fd0050e3
  1. 21
      Software/Sender/Sender.ino
  2. 41
      Software/TempSender/TempSender.ino

21
Software/Sender/Sender.ino

@ -9,8 +9,16 @@
// include the library code: // include the library code:
#include <SoftRS485.h> #include <SoftRS485.h>
// 0=Test
// 1=Arbeitszimmer
// 2=Küche
// 3=Bad
// 4=Treppenhaus
#define ID 4 #define ID 4
#define PROGRAM "RS485-Nano 2.1 / Sender 1.3" #define PROGRAM "Sender"
#define VERSION "1.3"
#define REVISION "2.1"
#define BTN_INT 3 // button interrupt pin #define BTN_INT 3 // button interrupt pin
#define Max485_RO 2 // read-output of Max485 #define Max485_RO 2 // read-output of Max485
@ -20,12 +28,8 @@
#define TRESHOLD 1024 #define TRESHOLD 1024
#define TRIGGER_LEVEL 200 #define TRIGGER_LEVEL 200
// 0=Test
// 1=Arbeitszimmer
// 2=Küche
// 3=Bad
// 4=Treppenhaus
#define DEBUG
//#define LOG_TO_SERIAL //#define LOG_TO_SERIAL
#define SEND_485 #define SEND_485
@ -55,8 +59,9 @@ void setup(){
pinMode(21,INPUT_PULLUP); pinMode(21,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(BTN_INT),isr,CHANGE); attachInterrupt(digitalPinToInterrupt(BTN_INT),isr,CHANGE);
// Print a message to the LCD. String s = "{nano:"+String(ID)+",hw:"+REVISION+","+PROGRAM+":"+VERSION+"}";
Serial.println(PROGRAM); Serial.println(s);
send485(s.c_str());
#ifdef LOG_TO_SERIAL #ifdef LOG_TO_SERIAL
Serial.println("14 15 16 17 18 19 20 21"); Serial.println("14 15 16 17 18 19 20 21");
#endif #endif

41
Software/TempSender/TempSender.ino

@ -12,7 +12,16 @@
#include <SoftRS485.h> #include <SoftRS485.h>
#include <AM2302-Sensor.h> #include <AM2302-Sensor.h>
#define VERSION "1.2" // 0=Test
// 1=Arbeitszimmer
// 2=Küche
// 3=Bad
// 4=Treppenhaus
#define ID 1
#define PROGRAM "TempSender"
#define VERSION "1.3"
#define REVISION "2.0"
#define BTN_INT 3 // button interrupt pin #define BTN_INT 3 // button interrupt pin
#define Max485_RO 2 // read-output of Max485 #define Max485_RO 2 // read-output of Max485
@ -21,15 +30,12 @@
#define Max485_DI 9 // data input of Max485 #define Max485_DI 9 // data input of Max485
#define TRESHOLD 1024 #define TRESHOLD 1024
#define TRIGGER_LEVEL 200
#define DHT_PIN 4 #define DHT_PIN 4
#define PERIOD 100000000 // 100s #define PERIOD 100000000 // 100s
#define ID 0 //define DEBUG
// 0=Test
// 1=Arbeitszimmer
// 2=Küche
// 3=Bad
//#define LOG_TO_SERIAL //#define LOG_TO_SERIAL
#define SEND_485 #define SEND_485
@ -62,8 +68,7 @@ void setup(){
pinMode(21,INPUT_PULLUP); pinMode(21,INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(BTN_INT),isr,CHANGE); attachInterrupt(digitalPinToInterrupt(BTN_INT),isr,CHANGE);
// Print a message to the LCD. String s = "{nano:"+String(ID)+",hw:"+REVISION+","+PROGRAM+":"+VERSION+"}";
String s = "{nano:"+String(ID)+",revision:2.1,TempSender:"+VERSION+"}";
Serial.println(s); Serial.println(s);
send485(s.c_str()); send485(s.c_str());
#ifdef LOG_TO_SERIAL #ifdef LOG_TO_SERIAL
@ -72,15 +77,15 @@ void setup(){
} }
void isr(){ void isr(){
raw_states[0] = analogRead(14)<400; raw_states[0] = analogRead(14)<TRIGGER_LEVEL;
raw_states[1] = analogRead(15)<400; raw_states[1] = analogRead(15)<TRIGGER_LEVEL;
raw_states[2] = analogRead(16)<400; raw_states[2] = analogRead(16)<TRIGGER_LEVEL;
raw_states[3] = analogRead(17)<400; raw_states[3] = analogRead(17)<TRIGGER_LEVEL;
raw_states[4] = analogRead(18)<400; raw_states[4] = analogRead(18)<TRIGGER_LEVEL;
raw_states[5] = analogRead(19)<400; raw_states[5] = analogRead(19)<TRIGGER_LEVEL;
raw_states[6] = analogRead(20)<400; raw_states[6] = analogRead(20)<TRIGGER_LEVEL;
raw_states[7] = analogRead(21)<400; raw_states[7] = analogRead(21)<TRIGGER_LEVEL;
#ifdef LOG_TO_SERIAL #ifdef LOG_TO_SERIAL
for (int i=0;i<8;i++){ for (int i=0;i<8;i++){
Serial.print(" "); Serial.print(" ");

Loading…
Cancel
Save