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. Using MySensors feature in a library

Using MySensors feature in a library

Scheduled Pinned Locked Moved Troubleshooting
1 Posts 1 Posters 477 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.
  • Kai BepperlingK Offline
    Kai BepperlingK Offline
    Kai Bepperling
    wrote on last edited by Kai Bepperling
    #1

    Hey guys,

    im using the mysensors 2 library and im trying to use the wait and sleep feature in my own library to seperate project features. I tried the following:

    MotionSensor.h:

    #ifndef MotionSensor_h
    #define MotionSensor_h
    
    	#include "../MySensors/core/MySensorsCore.h"
    	#include "SPI.h" 
    	#include "Arduino.h"
    .
    .
    .
    #endif
    

    MotionSensor.cpp:

    #include <MotionSensor.h>
    
    MotionSensor::MotionSensor(int pin,  int initTime)
    {
    	_pin = pin;
    	pinMode(_pin, INPUT);
    
    	for(int i = 0; i < initTime; i++){
    		wait(1000);
    	}
    }
    

    and in my main sketch im setting everything up:

    // MySensorStuff
    #define MY_DEBUG //Comment out in production mode
    #define MY_RADIO_NRF24 //use the NRF24L01+ module
    #include <SPI.h>
    #include <MySensors.h>
    
    #include <MotionSensor.h>
    MotionSensor motion(2, 2);
    
    void setup(){
    Serial.println("setup");
    }
    
    void presentation(){
     sendSketchInfo("TestSketch", "1.0");
    
    void loop(){
    Serial.println("loop");
    }
    

    The code will compile but on my Arduino Uno the Network will not setup. Hope you guys can help me out :+1:

    1 Reply Last reply
    0

    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


    9

    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