roller shutter



  • hi
    this is a roller shutter sketch that i wrote 🙂 a simple sketch 🙂

    #define MY_DEBUG
    #define MY_RADIO_NRF24
    #define MY_RF24_CHANNEL 0
    #define MY_REPEATER_FEATURE
    #include MY_NODE_ID 20
    
    #include <SPI.h>
    #include <MySensors.h>
    
    #define RELAY_1  3
    #define RELAY_2  4
    
    
    
    void before() {
      int sensor = 1;
      pinMode(RELAY_1, OUTPUT);
      pinMode(RELAY_2, OUTPUT);
      digitalWrite(RELAY_1,HIGH);
      digitalWrite(RELAY_2,HIGH);
    
    }
    
    
    
    void setup() {
    }
    void presentation()
    {
      sendSketchInfo("Roller shutter", "1.0");
      int sensor = 1 ;
      present(sensor, S_COVER);
    }
    
    void loop() {
    }
    void receive(const MyMessage &message) {
      if (message.type == V_UP) {
        digitalWrite(RELAY_1, HIGH);
        delay(500);
        digitalWrite(RELAY_2, LOW);
      }
      if (message.type == V_STOP ) {
        digitalWrite(RELAY_1, HIGH);
        delay(500);
        digitalWrite(RELAY_2, HIGH);
      }
      if (message.type == V_DOWN) {
        digitalWrite(RELAY_2, HIGH);
        delay(500);
        digitalWrite(RELAY_1, LOW);
      }
    }
    


  • Nice, I was wondering about something like this but couldn't think how you'd handle limits? Unless the motor handles them..



  • @Qu3Uk said:

    Nice, I was wondering about something like this but couldn't think how you'd handle limits? Unless the motor handles them..

    there is a 2channel relay and motor left round wire is connect to one relay and motor right round wire is connect to other channel.
    here HIGH = off and LOW = on
    for left round (right round is off and left round is on)
    for right round (left round is off and right round is on)
    for stop both is off
    🙂



  • @Reza Oh I understand that but with stop command you could quite quickly have the shutter fully open but the motors still running. Right?



  • @Qu3Uk said:

    @Reza Oh I understand that but with stop command you could quite quickly have the shutter fully open but the motors still running. Right?

    i dont test it yet but i think you right 🙂


Log in to reply
 

Suggested Topics

  • 8
  • 44
  • 2
  • 90
  • 1
  • 2

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts