-->
Page 3 of 19

Re: RGB Controller for Apple HomeKit and Siri (NodeMCU-ESP82

PostPosted: Fri Feb 10, 2017 8:23 pm
by eqsOne
You're right, that way it should work and also sounds quite simple indeed.

Re: RGB Controller for Apple HomeKit and Siri (NodeMCU-ESP82

PostPosted: Sat Feb 11, 2017 5:32 am
by eqsOne
This should add a push button to GPIO5, using the on/off url's like suggested by DaPeace. Sometimes I tend to think more complicated than it actually is, I guess.

Not tested, but adding the following lines to the sketch should do the trick?!

Code: Select all
EDIT: Nope, too quick


Re: RGB Controller for Apple HomeKit and Siri (NodeMCU-ESP82

PostPosted: Mon Feb 13, 2017 2:34 pm
by eqsOne
Added some delay to the switch comands, without it fired too quick. This kind of delay should also not affect the rest of the loop:

Code: Select all
#define Button 5 //D1 (GPIO5)

unsigned long previousMillis = 0;
unsigned long interval = 500; //Delays for 500ms before firing again. Change value to your likes.

//void setup() {
  pinMode(Button, INPUT_PULLUP); //set GPIO5 'high'
//}

//void loop() {
  int buttonState = digitalRead(Button);

  if (buttonState == LOW) {
    if (state == 0){
      if (millis() - previousMillis > interval) {
      previousMillis = millis();
      setHex();
      }
    }
    else {
      if (millis() - previousMillis > interval) {
      previousMillis = millis();
      allOff();
      }
    }
  }
//}


This should make a wired push-button (GPIO5/ground) work on the NodeMCU. Still untested but works fine with serial output testing.

Re: RGB Controller for Apple HomeKit and Siri (NodeMCU-ESP82

PostPosted: Tue Feb 21, 2017 7:24 pm
by thecoder
Thanks so much for making this.
I'm having one problem with it, though. When I try to compile and upload, I get an error saying:
"exit status 1"
"'max' was not declared in this scope"
And it points to the "x = max(R,G);" line.
I'm just starting out with ESP8266 and Arduino IDE generally, so my attempts to fix this weren't really successful haha
What might be the problem?