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. Development
  3. Vs2015+Visual Micro + MySensors

Vs2015+Visual Micro + MySensors

Scheduled Pinned Locked Moved Development
5 Posts 3 Posters 1.8k 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.
  • Y Offline
    Y Offline
    yoram
    wrote on last edited by
    #1

    Hi,
    I've tried to migrate from the arduino IDE to the VS2015 Community+Visual Micro support for Arduino.
    When attempting to compile a sketch with MyMessage and receive handler I get an error "BatteryPoweredWaterLeakSensor.ino:39:20: error: 'MyMessage' does not name a type"

    When excluding the define of MyMessage and the receive handler there is no problem and project compile with no errors:

    void receive(const MyMessage &message) {
    
    }
    

    Compiling the same sketch with the Arduino IDE or when removing the MyMessage usage I get no errors.

    Any idea?

    1 Reply Last reply
    0
    • mfalkviddM Online
      mfalkviddM Online
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      Do the vanilla examples work? (like https://github.com/mysensors/MySensors/blob/master/examples/DimmableLight/DimmableLight.ino )

      You'll probably get the same error but it might be worth checking.

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        yoram
        wrote on last edited by
        #3

        OK,
        I was able to find the RCA.
        Apparently, the issue was related to the location of the #include and the const variables.
        The following code generates error

        const int SENSOR_ANALOG_PINS[] = { A0, A1 }; 
        
        #include <SPI.h>
        #include <MySensors.h>
        
        #define CHILD_ID_SENSOR		0
        #define CHILD_ID_VOLTAGE	1
        
        
        MyMessage msgTripped(CHILD_ID_SENSOR, V_TRIPPED);
        MyMessage msgVoltage(CHILD_ID_VOLTAGE, V_VOLTAGE);
        
        

        The following code is GOOD. Hence, the const values has to be defined post the header include

        #include <SPI.h>
        #include <MySensors.h>
        
        #define CHILD_ID_SENSOR		0
        #define CHILD_ID_VOLTAGE	1
        
        
        MyMessage msgTripped(CHILD_ID_SENSOR, V_TRIPPED);
        MyMessage msgVoltage(CHILD_ID_VOLTAGE, V_VOLTAGE);
        
        const int SENSOR_ANALOG_PINS[] = { A0, A1 }; 
        
        1 Reply Last reply
        0
        • mfalkviddM Online
          mfalkviddM Online
          mfalkvidd
          Mod
          wrote on last edited by
          #4

          Strange. To my knowledge, that shouldn't matter. But great that you found a solution.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SiLeX
            wrote on last edited by SiLeX
            #5

            I can absolutely confirm this with VS2015, Visual Micro and MySensors 2.1.1. This is clearly a kind of merging, that is done by Visual Micro.

            All includes have to be made BEFORE the first line of code is executed. The initialization of your SENSOR_ANALOG_PINS array is such a line of code.

            Just posting it to keep it visible and well-scored at search engines, as this is SOLVED and works fine. Thank you!

            1 Reply Last reply
            1

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            17

            Online

            12.0k

            Users

            11.2k

            Topics

            113.4k

            Posts


            Copyright 2025 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