File 3d print
0_1461521471055_PROGETTO_base.stl
I need help on the code
Pin 3/4 Relay
Pin 6/7 Switches
https://codebender.cc/sketch:291491
BinarySwitch Sensor Example, we agree to aid in the development of the code.
work in progress.
File 3d print
0_1461521471055_PROGETTO_base.stl
I need help on the code
Pin 3/4 Relay
Pin 6/7 Switches
https://codebender.cc/sketch:291491
BinarySwitch Sensor Example, we agree to aid in the development of the code.
work in progress.
recapping sensor h2o 2 relays 2 buttons I used this code to optimize the water heater in the bathroom and detect water on the floor
the dish is ready
https://codebender.cc/sketch:210051
I have one better, but how to implement it in code mysensor?
.
New Code > sketch + Library > https://codebender.cc/sketch:183503
Original Code
#include <MyTransportNRF24.h>
#include <MyHwATMega328.h>
#include <MySensor.h>
#include <SPI.h>
#include <Wire.h>
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
#define NODE_ID 165
#define NODE_VERSION "1.1"
#define NODE_DESCRIPTION "MikRelay"
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2
#define RADIO_TX_PIN 2
#define NUMBER_OF_RELAYS 11 // Total number of attached relays
typedef struct
{
unsigned long address;
unsigned char unit;
bool dimmer;
} MikParams;
MikParams Mik_PARAMS[NUMBER_OF_RELAYS] =
{
{87311, 24, false},
{87500, 24, false},
{87491, 24, false},
{87359, 24, false},
{87539, 24, false},
{87548, 24, false},
{87536, 24, false},
{87356, 24, false},
{87503, 24, false},
{4011779, 24, false},
{4011968, 24, false}
};
// NRFRF24L01 radio driver (set low transmit power by default)
MyTransportNRF24 radio(RF24_CE_PIN, RF24_CS_PIN, RF24_PA_LEVEL_GW);
//MyTransportRFM69 radio;
// Message signing driver (none default)
//MySigningNone signer;
// Select AtMega328 hardware profile
MyHwATMega328 hw;
// Construct MySensors library
MySensor gw(radio, hw);
void setup()
{
mySwitch.enableTransmit(RADIO_TX_PIN);
// init done
// Show image buffer on the display hardware.
// Since the buffer is intialized with an Adafruit splashscreen
// internally, this will display the splashscreen.
// Initialize library and add callback for incoming messages
gw.begin(incomingMessage, NODE_ID, false);
delay(2000);
// Send the sketch version information to the gateway and Controller
gw.sendSketchInfo(NODE_DESCRIPTION, NODE_VERSION);
// Fetch relay status
for (int sensor = 1; sensor <= NUMBER_OF_RELAYS; sensor++) {
// Register all sensors to gw (they will be created as child devices)
gw.present(sensor, S_LIGHT);
}
}
void loop()
{
// Alway process incoming messages whenever possible
gw.process();
}
void incomingMessage(const MyMessage &message)
{
if ((message.sensor < 1) && (message.sensor >= NUMBER_OF_RELAYS))
{
return;
}
if (message.type == V_LIGHT)
{
mySwitch.send(Mik_PARAMS[message.sensor - 1].address, Mik_PARAMS[message.sensor - 1].unit);
// Store state in eeprom
gw.saveState(message.sensor, message.getBool());
// Write some debug info
Serial.print("Incoming change for sensor:");
Serial.print(message.sensor);
Serial.print(", Miks: ");
Serial.print(Mik_PARAMS[message.sensor - 1].address);
Serial.print(", Miks: ");
Serial.print(Mik_PARAMS[message.sensor - 1].unit);
Serial.print(", New status: ");
Serial.println(message.getBool());
}
else if (message.type == V_DIMMER)
{
mySwitch.send(Mik_PARAMS[message.sensor - 1].address, Mik_PARAMS[message.sensor - 1].unit);
}
}```
I know that not everyone. but there is some kind soul can help me?
I see you do not laugh!
@mfalkvidd I wanted to see if you were ready It can help someone
the problem was the radio module nrf24, replacing it I solved
ps
when you see lots of nrf24 not buy them on the cheap. thank you all for the support
Hi, I have a MFRC522 module, and I would like to implement it with 2.0 library. could I use this code?
I bought an orange pi 2 but by many problems and support is null.
This orange pi zero for what you use it for mysensor?
@mfalkvidd for me is new and on the forum I do not find many skeck Library 2.0
for this device
I wondered, but you can create an Ethernet gateway with the new Arduino MCU wifi module? and where can I find sketches Library 2.0? thank you all
Hi, I have a MFRC522 module, and I would like to implement it with 2.0 library. could I use this code?
@mfalkvidd I wanted to see if you were ready It can help someone
you have been very kind, you also tell me, where can I find the old serial sketches compatible for mysensors version 1.5?
I have two questions ...
one) this sketch only works with version mysensors_v2.0 it?
two) all the old skeck are no longer usable?
thank you