-
Notifications
You must be signed in to change notification settings - Fork 125
Description
Hi all,
i have this simple sketch for Arduino UnoR3/W5100:
#include "SoulissFramework.h"
#include "bconf/StandardArduino.h"
#include "conf/ethW5100.h"
#include "conf/Gateway.h"
#include <Adafruit_Sensor.h>
#include <DHT_U.h>
#include <SPI.h>
#include "Souliss.h"
// Slot
#define BLUE_LIGHT 0
#define RED_LIGHT 1
#define TEMPERATURE 2
#define HUMIDITY 4
//PINout
#define PIR_PIN 5
#define BLUE_LIGHT_PIN 8
#define RED_LIGHT_PIN 9
#define DHT_PIN 2
//Networking
uint8_t ip_address[4] = {10, 1, 0, 77};
uint8_t subnet_mask[4] = {255, 255, 0, 0};
uint8_t ip_gateway[4] = {10, 1, 0, 1};
#define myvNet_address ip_address[3]
#define myvNet_subnet 0xFF00
#define DHTTYPE DHT11
DHT dht(DHT_PIN, DHTTYPE);
void setup()
{
//Init
Serial.begin(9600);
dht.begin();
Initialize();
Souliss_SetIPAddress(ip_address, subnet_mask, ip_gateway);
SetAsGateway(myvNet_address);
// setup typicals
Set_T12(BLUE_LIGHT);
Set_T11(RED_LIGHT);
Set_Temperature(TEMPERATURE);
Set_Humidity(HUMIDITY);
// setup pin
pinMode(BLUE_LIGHT_PIN, OUTPUT);
pinMode(RED_LIGHT_PIN, OUTPUT);
pinMode(DHT_PIN, INPUT);
pinMode(PIR_PIN, INPUT);
}
void loop()
{
EXECUTEFAST() {
UPDATEFAST();
FAST_10ms() {
ProcessCommunication();
}
FAST_50ms() {
DigIn(PIR_PIN, 10, BLUE_LIGHT);
Logic_T12(BLUE_LIGHT);
Logic_SimpleLight(RED_LIGHT);
DigOut(RED_LIGHT_PIN, Souliss_T1n_Coil, RED_LIGHT);
nDigOut(BLUE_LIGHT_PIN, Souliss_T1n_Coil, BLUE_LIGHT);
}
FAST_7110ms(){
Timer_T12(BLUE_LIGHT);
}
FAST_GatewayComms();
}
EXECUTESLOW() {
UPDATESLOW();
SLOW_10s() {
Logic_Temperature(TEMPERATURE);
Logic_Humidity(HUMIDITY);
}
SLOW_50s() {
Souliss_ReadDHT(TEMPERATURE, HUMIDITY);
}
}
}
void Souliss_ReadDHT(uint8_t TEMPERATURE_SLOT, uint8_t HUMIDITY_SLOT){
float h = dht.readHumidity() + 34.40;
float t = dht.readTemperature() + 24.4;
ImportAnalog(TEMPERATURE_SLOT, &t);
ImportAnalog(HUMIDITY_SLOT, &h);
}
I solved all the problems related to first setup and I'm able to control this single Arduino from my Android APP.
The strange thing is that, in this case, when the PIR on pin 5 is triggering the blue light for 10 cycles, and i switch on/off the red light from the Android app the blue light immediately switches off.
To make it clear i suggest this steps to reproduce:
- i make a movement behind the PIR sensor so the blue light goes ON for 10 cycles
- i switch ON the red light using the APP --> the blue light goes to OFF
- SOON i make another movement on the PIR and the blue light stays OFF
- after some time (i think the remaining part of 10 cycles) i move again on the PIR and the blue light goes to ON
- with the app i switch OFF the red light and also the blue light goes to OFF
- ... and so on....
I will try to enable the debug(s) and try to understand why there is this problem.
This is not a complete system or a part of the system, but it is only a sandbox that i use to study the framework and use all my sensors/actuators.
The souliss version is 7.2.1 friariello 😃
Any help or direction will be appreciated.
Thank you.
PN