Basic project setup from start to finish
-
Should I create another folder in there called sketches? Here is my sketch copy and pasted from the example on this page: https://www.mysensors.org/build/motion
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * */ // Enable debug prints // #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <MySensors.h> unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { // Read digital motion value bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }``` -
Here is what my Arduino folder looks like: https://www.dropbox.com/s/hfsg3d1xkcoydqq/Screenshot 2016-10-21 16.36.51.png?dl=0
-
Should I create another folder in there called sketches? Here is my sketch copy and pasted from the example on this page: https://www.mysensors.org/build/motion
/** * The MySensors Arduino library handles the wireless radio link and protocol * between your home built sensors/actuators and HA controller of choice. * The sensors forms a self healing radio network with optional repeaters. Each * repeater and gateway builds a routing tables in EEPROM which keeps track of the * network topology allowing messages to be routed to nodes. * * Created by Henrik Ekblad <henrik.ekblad@mysensors.org> * Copyright (C) 2013-2015 Sensnology AB * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors * * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * ******************************* * * REVISION HISTORY * Version 1.0 - Henrik Ekblad * * DESCRIPTION * Motion Sensor example using HC-SR501 * http://www.mysensors.org/build/motion * */ // Enable debug prints // #define MY_DEBUG // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 #include <MySensors.h> unsigned long SLEEP_TIME = 120000; // Sleep time between reports (in milliseconds) #define DIGITAL_INPUT_SENSOR 3 // The digital input you attached your motion sensor. (Only 2 and 3 generates interrupt!) #define CHILD_ID 1 // Id of the sensor child // Initialize motion message MyMessage msg(CHILD_ID, V_TRIPPED); void setup() { pinMode(DIGITAL_INPUT_SENSOR, INPUT); // sets the motion sensor digital pin as input } void presentation() { // Send the sketch version information to the gateway and Controller sendSketchInfo("Motion Sensor", "1.0"); // Register all sensors to gw (they will be created as child devices) present(CHILD_ID, S_MOTION); } void loop() { // Read digital motion value bool tripped = digitalRead(DIGITAL_INPUT_SENSOR) == HIGH; Serial.println(tripped); send(msg.set(tripped?"1":"0")); // Send tripped value to gw // Sleep until interrupt comes in on motion sensor. Send update every two minute. sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME); }``` -
@toddsantoro something in the Arduino IDE is referencing libraries/TAS_motion_sensor. Do you have any idea what it could be? As AWI said, nothing should expect TAS_motion_sensor to be in the libraries folder.
@mfalkvidd I removed everything I have done and started new so that is why you do not see that in the library's folder. I would like to know the exact steps no matter how trivial they are to setting up the sensors project. I am a web programmer and that may be my issue because I know how I would set things up but that does not mean thaty are correct in this situation.
-
@mfalkvidd I removed everything I have done and started new so that is why you do not see that in the library's folder. I would like to know the exact steps no matter how trivial they are to setting up the sensors project. I am a web programmer and that may be my issue because I know how I would set things up but that does not mean thaty are correct in this situation.
@toddsantoro the instructions are available at https://www.mysensors.org/about/arduino
After installing the library you can open the examples from File->Examples->MySensors. There is no need to copy-paste from the build page (but that should work as well). -
@toddsantoro the instructions are available at https://www.mysensors.org/about/arduino
After installing the library you can open the examples from File->Examples->MySensors. There is no need to copy-paste from the build page (but that should work as well).@mfalkvidd OK. I will give it a try. Thanks for your help and patience. I hope to automate my whole 417 sqft home and then help others to do the same.
-
@mfalkvidd OK. I will give it a try. Thanks for your help and patience. I hope to automate my whole 417 sqft home and then help others to do the same.
@toddsantoro Actually I have read that and I am still in the dark. From the Arduino GUI I go FILE > NEW. COMMAND + S and save it where? It defaults to the Arduino folder on my machine with just Libraries directory in it. Do I create a SKETCHES folder and save the project there? I just don't know what to do???
-
@toddsantoro Actually I have read that and I am still in the dark. From the Arduino GUI I go FILE > NEW. COMMAND + S and save it where? It defaults to the Arduino folder on my machine with just Libraries directory in it. Do I create a SKETCHES folder and save the project there? I just don't know what to do???
-
@toddsantoro save it in the suggested directory, next to (not inside) the libraries folder.
@mfalkvidd ok... what goes in the file? Copy paste from the example of do I somehow use the motion sensor library? I want to get a basic, best practices work flow going. Again thanks for your help.
-
@mfalkvidd ok... what goes in the file? Copy paste from the example of do I somehow use the motion sensor library? I want to get a basic, best practices work flow going. Again thanks for your help.