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.6k 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.
  • yoramY Offline
    yoramY 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 Offline
      mfalkviddM Offline
      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
      • yoramY Offline
        yoramY 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 Offline
          mfalkviddM Offline
          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
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            17

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            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