I'm starting off basic...I want to have a pushbutton toggle an output off and on, then i'll be elborating with more pushbuttons and outputs, then link it to HS. This is what I have so far:
Now I can get this code to run just fine on it's on, but when I put it into the HS API I get a compiling error due to the use of "time". Any idea as the time is used for debounce with this switch but also must be used in the HS section too.
Code:
/************************************************************* *Arduino to Homeseer 3 Plugin API written by Enigma Theatre.* * V1.0.0.140 * * * *************************************************************/ int FromHS[50]; boolean IsConnected = false; //************************************************************ //**************Declare your variables here******************* //Inputs int FogPin = 10; //Outputs int DrivFogLight = 16; int PassFogLight = 5; //Variables int stateFog = HIGH; int readingFog; int previousFog = LOW; long time = 0; long debounce = 200; //**************************************************************** void HSSetup() { //************************ //Add YOUR SETUP HERE; //************************ //Define Input Pins pinMode(FogPin, INPUT); //Define Output Pins pinMode(DrivFogLight, OUTPUT); pinMode(PassFogLight, OUTPUT); } void HSloop() { //************************ //Add YOUR CODE HERE; //************************ /* To Send Data to Homeseer use SendToHS(Device,Value) Eg.. SendToHS(1,200); where 1 is the API device in homeseer and 200 is the value to send To Recieve data from Homeseer look up the FromHS array that is updated when the device value changes. Eg.. FromHS[5] would be the data from API Output device 5 All code that is located just below this block will execute regardless of connection status! You can include SendToHS() calls, however when there isn't an active connection, it will just return and continue. If you only want code to execute when HomeSeer is connected, put it inside the if statement below. */ /*Execute regardless of connection status*/ //Monitoring the Fog Light Pin readingFog = digitalRead(FogPin); // if we just pressed the button (i.e. the input went from LOW to HIGH), // and we've waited long enough since the last press to ignore any noise... if (readingFog == HIGH && previousFog == LOW && millis() - time > debounce) { // ... invert the output if (stateFog == HIGH) stateFog = LOW; else stateFog = HIGH; // ... and remember when the last button press was time = millis(); } digitalWrite(DrivFogLight, stateFog); digitalWrite(PassFogLight, stateFog); previousFog = readingFog; if (IsConnected == true) { /*Execute ONLY when HomeSeer is connected*/ } } //************Do not change anything after Here*****************
C:\Users\conradan\AppData\Local\Temp\arduino_build_565717/arduino.ar(time.c.o): In function `time':
C:\Users\conradan\AppData\Local\Arduino15\packages\esp8266\h ardware\esp8266\2.3.0-rc2\cores\esp8266/time.c:93: multiple definition of `time'
C:\Users\conradan\AppData\Local\Temp\arduino_build_565717\sk etch\APIBoard3.ino.cpp.o.bss.time+0x0): first defined here
c:/users/conradan/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: Warning: size of symbol `time' changed from 4 in C:\Users\conradan\AppData\Local\Temp\arduino_build_565717\sk etch\APIBoard3.ino.cpp.o to 29 in C:\Users\conradan\AppData\Local\Temp\arduino_build_565717/arduino.ar(time.c.o)
c:/users/conradan/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: Warning: type of symbol `time' changed from 1 to 2 in C:\Users\conradan\AppData\Local\Temp\arduino_build_565717/arduino.ar(time.c.o)
collect2.exe: error: ld returned 1 exit status
C:\Users\conradan\AppData\Local\Arduino15\packages\esp8266\h ardware\esp8266\2.3.0-rc2\cores\esp8266/time.c:93: multiple definition of `time'
C:\Users\conradan\AppData\Local\Temp\arduino_build_565717\sk etch\APIBoard3.ino.cpp.o.bss.time+0x0): first defined here
c:/users/conradan/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: Warning: size of symbol `time' changed from 4 in C:\Users\conradan\AppData\Local\Temp\arduino_build_565717\sk etch\APIBoard3.ino.cpp.o to 29 in C:\Users\conradan\AppData\Local\Temp\arduino_build_565717/arduino.ar(time.c.o)
c:/users/conradan/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: Warning: type of symbol `time' changed from 1 to 2 in C:\Users\conradan\AppData\Local\Temp\arduino_build_565717/arduino.ar(time.c.o)
collect2.exe: error: ld returned 1 exit status
Comment