Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
D

dany17

@dany17
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Mysensor usb gateway serial problem
    D dany17

    @kimot
    yes I know this is an error but I wanted to read the value from pin 4. this example worked for me (RelayActuator) I wanted to use this ordinary switch to control the rest of the program. that's all I need at the moment

    Development

  • Mysensor usb gateway serial problem
    D dany17

    I would like to use this program in mysensors with a switch from domoticz

    #include <Stepper.h>
    #define STEPS 32 
    Stepper stepper (STEPS, 8, 10, 9, 11); 
    int val = 0;
    
    void setup () { 
      Serial.begin (9600);
     stepper.setSpeed (800); 
      pinMode(4, INPUT_PULLUP); 
    
    }
    
    void loop () {
      if (digitalRead (4) == LOW) 
      { 
        val = 20480; 
        stepper.step (val); 
        Serial.println (val); 
      }
      
     if (digitalRead (4) == HIGH) 
      {
        val = -20480; 
        stepper.step (val); 
        Serial.println (val); 
    }
    }
    
    Development

  • Mysensor usb gateway serial problem
    D dany17

    @scalz said in Mysensor usb gateway serial problem:

    If it doesn't help, like mfalkvidd said please show us your debug logs.

    OK i do //#define MY_RADIO_RF24 because for now I wanted to make a base station via usb

    I will tell you my idea and you will tell if it is possible here because I am slowly losing faith XD
    I want to use mega2560 to control several devices. One of them is the roller blind that I converted into electric motor control (currently I have two. The first classic 2 wires and I have connected to 3 contactors which control the direction and time of operation. The second stepper motor).
    I now want to use my sensor to control the blind in domoticz with 1 switch or if it could be slider.

    The next thing would be INA219 but maybe later for the time being on this roller blind, is it possible to do?

    Development

  • Mysensor usb gateway serial problem
    D dany17

    Hello, could somebody help me and say why it doesn't work?

    // Enable debug prints to serial monitor
    #define MY_DEBUG
    
    
    // Enable and select radio type attached
    //#define MY_RADIO_RF24
    //#define MY_RADIO_NRF5_ESB
    //#define MY_RADIO_RFM69
    //#define MY_RADIO_RFM95
    
    // Set LOW transmit power level as default, if you have an amplified NRF-module and
    // power your radio separately with a good regulator you can turn up PA level.
    #define MY_RF24_PA_LEVEL RF24_PA_LOW
    
    // Enable serial gateway
    #define MY_GATEWAY_SERIAL
    
    // Define a lower baud rate for Arduinos running on 8 MHz (Arduino Pro Mini 3.3V & SenseBender)
    #if F_CPU == 8000000L
    #define MY_BAUD_RATE 38400
    #endif
    
    // Enable inclusion mode
    #define MY_INCLUSION_MODE_FEATURE
    // Enable Inclusion mode button on gateway
    //#define MY_INCLUSION_BUTTON_FEATURE
    
    // Inverses behavior of inclusion button (if using external pullup)
    //#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
    
    // Set inclusion mode duration (in seconds)
    #define MY_INCLUSION_MODE_DURATION 60
    // Digital pin used for inclusion mode button
    //#define MY_INCLUSION_MODE_BUTTON_PIN  3
    
    // Set blinking period
    #define MY_DEFAULT_LED_BLINK_PERIOD 300
    
    // Inverses the behavior of leds
    //#define MY_WITH_LEDS_BLINKING_INVERSE
    
    // Flash leds on rx/tx/err
    // Uncomment to override default HW configurations
    //#define MY_DEFAULT_ERR_LED_PIN 4  // Error led pin
    //#define MY_DEFAULT_RX_LED_PIN  6  // Receive led pin
    //#define MY_DEFAULT_TX_LED_PIN  5  // the PCB, on board LED
    
    #include <MySensors.h>
    
    #define CHILD_ID 3
    #define BUTTON_PIN  3 
    
    #define RELAY_PIN 4  // Arduino Digital I/O pin number for first relay (second on pin+1 etc)
    #define NUMBER_OF_RELAYS 1 // Total number of attached relays
    #define RELAY_ON 1  // GPIO value to write to turn on attached relay
    #define RELAY_OFF 0 // GPIO value to write to turn off attached relay
    
    
    void before()
    {
      for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
        // Then set relay pins in output mode
        pinMode(pin, OUTPUT);
        // Set relay to last known state (using eeprom storage)
        digitalWrite(pin, loadState(sensor)?RELAY_ON:RELAY_OFF);
      }
    }
    
    int gate = 23;   
    int relay1 =  22; 
    
    
    void setup()
    {
      Serial.begin (115200);
        pinMode(BUTTON_PIN,INPUT);
        digitalWrite(BUTTON_PIN,HIGH);
      
        pinMode(relay1, OUTPUT);
        digitalWrite (relay1, LOW);
        pinMode(gate, OUTPUT);
        digitalWrite (gate, LOW);
        pinMode(24, INPUT_PULLUP);
    }
    
    void presentation()
    {
      // Send the sketch version information to the gateway and Controller
      sendSketchInfo("Relay", "1.0");
    
      for (int sensor=1, pin=RELAY_PIN; sensor<=NUMBER_OF_RELAYS; sensor++, pin++) {
        // Register all sensors to gw (they will be created as child devices)
        present(sensor, S_BINARY);
      }
    }
    
    
    void loop()
    {
       byte value = analogRead(0);
     if (value == LOW){
      delay(10); 
      digitalWrite(gate, LOW);
     digitalWrite(relay1, LOW);
     delay(2000); 
     digitalWrite(gate, HIGH);
      } 
      
      if (value == HIGH){
      delay(10);
      digitalWrite(gate, LOW);
     digitalWrite(relay1, HIGH);
      delay(2000); 
      digitalWrite(gate, HIGH);
    
      }
    
    }
    
    void receive(const MyMessage &message)
    {
      // We only expect one type of message from controller. But we better check anyway.
      if (message.type==V_STATUS) {
        // Change relay state
        digitalWrite(message.sensor-1+RELAY_PIN, message.getBool()?RELAY_ON:RELAY_OFF);
        // Store state in eeprom
        saveState(message.sensor, message.getBool());
        // Write some debug info
        Serial.print("Incoming change for sensor:");
        Serial.print(message.sensor);
        Serial.print(", New status: ");
        Serial.println(message.getBool());
      }
    }
    
    Development
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular