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. platformio and mysensors for atmega328p on breadboard?

platformio and mysensors for atmega328p on breadboard?

Scheduled Pinned Locked Moved Troubleshooting
5 Posts 3 Posters 2.0k Views 1 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.
  • N Offline
    N Offline
    n8henrie
    wrote on last edited by
    #1

    Hi all,

    I am new to MySensors, and I have only limited experience with platformio and Arduino programming in general.

    I was able to get the temperature sensor built with a Nano and an NRF24L01+ I had laying around -- worked great! As usual, I used platformio to manage the dependencies and the build (I don't care much for the Arduino editor or library and board manager).

    Now I want to make a version of the same sketch using an atmega328p on a breadboard. I figure it should work as it's the same MCU.

    However, I'm running into a slew of errors, mostly "not declared in this scope." My INO file is identical to the one from the temp sensor tutorial.

    In file included from .piolibdeps/MySensors_ID548/MySensors.h:257:0,
    from rf24_temp/src/tempsensor.ino:38:
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void stInitTransition()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:80:45: error: 'hwReadConfigBlock' was not declared in this scope
    sizeof(transportConfig_t));
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void stInitUpdate()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:108:61: error: 'hwWriteConfig' was not declared in this scope
    hwWriteConfig(EEPROM_NODE_ID_ADDRESS, (uint8_t)MY_NODE_ID);
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void stUplinkUpdate()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:232:43: error: 'hwMillis' was not declared in this scope
    _transportSM.lastUplinkCheck = hwMillis();
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'void transportSwitchSM(transportState_t&)':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:342:37: error: 'hwMillis' was not declared in this scope
    _transportSM.stateEnter = hwMillis(); // save time
    ^
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp: In function 'uint32_t transportTimeInState()':
    .piolibdeps/MySensors_ID548/core/MyTransport.cpp:347:18: error: 'hwMillis' was not declared in this scope
    return hwMillis() - _transportSM.stateEnter;
    

    So far I've found a few useful links:

    • https://github.com/platformio/platformio-core/issues/331
    • https://github.com/platformio/platformio-core/issues/298
    • https://forum.mysensors.org/topic/3306/platformio-and-mysensors-development-branch/6

    What I've tried (with a pio run target=clean before each attempted build):

    • Adding #include <Arduino.h> to the top of my sketch (nothing changes)
    • Specifying build_flags = -I/path/to/MySensors
    • Specifying lib_ignore = MySensors

    I'm using:

    • MacOS 10.13.1
    • platformio 3.4.1
    • MySensors 2.1.1

    My platformio.ini:

    [env:328p8m]
    platform = atmelavr
    board = 328p8m
    framework = arduino
    upload_protocol = usbasp
    lib_deps = 
        MySensors
        DallasTemperature
    build_flags = -I../MySensors
    lib_ignore = MySensors
    

    Any ideas? Again, this builds fine with the same code but using a nano as the target platform, just won't build for the atmega328p for some reason.

    cc @gerritv @Iyad-Nahas

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

      Hi, welcome to the mysensors forum.

      About your problem, I'm not entirely sure that is mysensors related. Have you asked in the platformio forum?

      1 Reply Last reply
      0
      • N Offline
        N Offline
        n8henrie
        wrote on last edited by
        #3

        @gohan -- thanks! Sorry for the delayed response, thought I had email notifications for replies set up, but I guess not. Yeah, I'm not sure either, but I've used platformio for a number of other projects without running into this issue, so I thought there might be people here using MySensors with platformio that could perhaps shed some light.

        I'll ask over at their community forum first, and if I don't have any luck will likely make issues at both repos.

        Link to my cross-post there

        1 Reply Last reply
        0
        • S Offline
          S Offline
          smilvert
          wrote on last edited by
          #4

          @n8henrie

          I have installed the mysensors lib from platformio (platformio lib install xx, or something like that)

          And my platformio.ini file look like this:

          [env:pro8MHzatmega328]
          platform = atmelavr
          framework = arduino
          board = pro8MHzatmega328
          

          I think you could remove the build_flags and the lib_ignore

          1 Reply Last reply
          1
          • N Offline
            N Offline
            n8henrie
            wrote on last edited by
            #5

            Solved with some changes in the Dallas temp library (and platformio 3.5 which allows installing a library from a git url).

            My thread there: https://community.platformio.org/t/platformio-and-mysensors-for-atmega328p-on-breadboard-was-not-declared-in-this-scope/2994/7?u=n8henrie

            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


            22

            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