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
  1. Home
  2. Troubleshooting
  3. What settings for ESP8266 Node?

What settings for ESP8266 Node?

Scheduled Pinned Locked Moved Troubleshooting
2 Posts 2 Posters 959 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • siodS Offline
    siodS Offline
    siod
    wrote on last edited by
    #1

    Hi,

    I would like to convert the below sketch to a ESP8266 /WeMos D1 Mini compatible sketch. Do I have to change MY RADIO NRF24 to ESP8266 or sth like that? PS I am using MQTT and Openhab 2...

    /*
     * IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
     * An IR LED must be connected to Arduino PWM pin 3.
     * Version 0.1 July, 2009
     * Copyright 2009 Ken Shirriff
     * http://arcfn.com
     */
    
    #define MY_RADIO_NRF24 
    // Define Node ID
    #define MY_NODE_ID 5
    //#define MY_PARENT_NODE_ID 50 //Repeater Node 1!
    //#define MY_PARENT_NODE_IS_STATIC
    
    #include <MySensors.h>
    #include <SPI.h>
    #include <IRremote.h>
    
    #define CHILD_ID 1   // Id of the sensor child
    
    IRsend irsend;
    
    // Initialize message
    MyMessage msg(CHILD_ID, V_IR_SEND);
    
    void setup()
    {
      Serial.begin(9600);
    }
    
    void presentation()
    {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("LED Licht TV Steuerung", "1.0");
    
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID, S_IR);
    }
    
    void loop() {
    
    
    }
    
    void receive(const MyMessage &message) {
      // We only expect one type of message from controller. But we better check anyway.
       Serial.println(F("Incoming Message:"));
       Serial.println(message.getString());
      if (message.type == V_IR_RECEIVE) {
        // Send command to Turn LEDs On
        if (message.getString("anaus")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFF02FD, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        } 
            // Send command to Turn LEDs Red
        else if (message.getString("rot")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFF1AE5, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
            // Send command to Turn LEDs green
        else if (message.getString("gruen")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFF9A65, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                // Send command to Turn LEDs blue
        else if (message.getString("blau")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFA25D, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                    // Send command to Turn LEDs white
        else if (message.getString("weiss")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFF22DD, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                        // Send command to Turn LEDs faster
        else if (message.getString("schneller")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFE817, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                            // Send command to Turn LEDs slower
        else if (message.getString("langsamer")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFC837, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                   // Send command to Turn LEDs brighter
        else if (message.getString("heller")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFF3AC5, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
            // Send command to Turn LEDs darker
        else if (message.getString("dunkler")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFBA45, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                // Send command to Turn LEDs Fade7
        else if (message.getString("fade7")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFE01F, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
                    // Send command to Turn LEDs flash
        else if (message.getString("flash")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFD02F, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
        // Send command to Turn LEDs Jump7
        else if (message.getString("jump")) { 
        for (int i = 0; i < 3; i++) {
            irsend.sendNEC(0xFFA05F, 32);
            Serial.println(message.getString());
            Serial.println("Message sent");
            delay(40);
          }
        }
        else{ 
          // if nothing else matches, do the default
          // default is optional
          Serial.println("Nicht belegt");
          }
       }
     }
    

    still learning...

    1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      It depends if you want it connected via wifi or via nrf24, if the second just leave the nrf24 define

      1 Reply Last reply
      1
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      18

      Online

      11.7k

      Users

      11.2k

      Topics

      113.0k

      Posts


      Copyright 2019 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
      • Login

      • Don't have an account? Register

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