Skip to content
  • 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. General Discussion
  3. 'MySensors' does not name a type
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

'MySensors' does not name a type

Scheduled Pinned Locked Moved General Discussion
6 Posts 3 Posters 3.4k Views 2 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.
  • A Offline
    A Offline
    adrian_kbb73
    wrote on last edited by
    #1

    hello, i'm new in arduino and in das forum
    and i have this error in code
    i hope they can help me.
    /////////error//////////////
    exit status 1
    'MySensors' does not name a type
    /////////////////////////////////////////////////////////////

    A 1 Reply Last reply
    0
    • Sander StolkS Offline
      Sander StolkS Offline
      Sander Stolk
      wrote on last edited by
      #2

      Maybe post the code so that people can see what is wrong with your code

      1 Reply Last reply
      0
      • A adrian_kbb73

        hello, i'm new in arduino and in das forum
        and i have this error in code
        i hope they can help me.
        /////////error//////////////
        exit status 1
        'MySensors' does not name a type
        /////////////////////////////////////////////////////////////

        A Offline
        A Offline
        adrian_kbb73
        wrote on last edited by
        #3

        @adrian_kbb73
        #define MY_RADIO_RFM69
        #define MY_RFM69_FREQUENCY RF69_915MHZ
        #define MY_IS_RFM69HW
        #define MY_RF69_IRQ_PIN 2
        #define MY_RF69_SPI_CS 10
        #include <SPI.h>
        #include <MySensors.h>
        #include <DHT.h>

        #define CHILD_ID_HUM 0
        #define CHILD_ID_TEMP 1
        #define HUMIDITY_SENSOR_DIGITAL_PIN 3
        unsigned long SLEEP_TIME = 30000; // Sleep time between reads (in milliseconds)

        MySensors gw;/// Here I get the error
        DHT dht;
        float lastTemp;
        float lastHum;
        boolean metric = true;
        MyMessage msgHum(CHILD_ID_HUM, V_HUM);
        MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);

        void setup()
        {
        gw.begin();
        dht.setup(HUMIDITY_SENSOR_DIGITAL_PIN);

        // Send the Sketch Version Information to the Gateway
        gw.sendSketchInfo("Humidity", "1.0");

        // Register all sensors to gw (they will be created as child devices)
        gw.present(CHILD_ID_HUM, S_HUM);
        gw.present(CHILD_ID_TEMP, S_TEMP);

        metric = gw.getConfig().isMetric;
        }

        void loop()
        {
        delay(dht.getMinimumSamplingPeriod());

        float temperature = dht.getTemperature();
        if (isnan(temperature)) {
        Serial.println("Failed reading temperature from DHT");
        } else if (temperature != lastTemp) {
        lastTemp = temperature;
        if (!metric) {
        temperature = dht.toFahrenheit(temperature);
        }
        gw.send(msgTemp.set(temperature, 1));
        Serial.print("T: ");
        Serial.println(temperature);
        }

        float humidity = dht.getHumidity();
        if (isnan(humidity)) {
        Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
        lastHum = humidity;
        gw.send(msgHum.set(humidity, 1));
        Serial.print("H: ");
        Serial.println(humidity);
        }

        gw.sleep(SLEEP_TIME); //sleep a bit
        }

        1 Reply Last reply
        0
        • Sander StolkS Offline
          Sander StolkS Offline
          Sander Stolk
          wrote on last edited by
          #4

          This line is not necessary in MYS 2.0

          A 1 Reply Last reply
          0
          • Sander StolkS Sander Stolk

            This line is not necessary in MYS 2.0

            A Offline
            A Offline
            adrian_kbb73
            wrote on last edited by
            #5

            @Sander-Stolk
            o thank you, i will prove without that line

            mfalkviddM 1 Reply Last reply
            0
            • A adrian_kbb73

              @Sander-Stolk
              o thank you, i will prove without that line

              mfalkviddM Offline
              mfalkviddM Offline
              mfalkvidd
              Mod
              wrote on last edited by mfalkvidd
              #6

              @adrian_kbb73 Welcome to the MySensors commu ity!

              Most of this code seems to be for MySensors 1.x. It needs to be converted to work with 2.x. A guide is available at https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x/

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


              13

              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
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular