Using MySensors feature in a library
-
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" . . . #endifMotionSensor.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:
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