Code Monkey home page Code Monkey logo

Comments (4)

Aircoookie avatar Aircoookie commented on August 30, 2024

Hey,
of course that is possible! Follow the basic example or readme on how to create an EspalexaDevice object :)
With that, additional functions are available and you can do something like:

void colorLightChanged(uint8_t brightness, uint32_t rgb)
{
  uint16_t hue = colorDevice->getHue();
  byte sat = colorDevice->getSat();
  uint16_t ct = colorDevice->getCt();
}

Keep in mind that when setting color temperature (white spectrum), Hue and Sat will not be updated.
Also, if hue and sat are updated, ct will default to 500. You can check wheter Hue+Sat or ct are currently valid with colorDevice->isColorTemperatureMode()

from espalexa.

ChristianKnorr avatar ChristianKnorr commented on August 30, 2024

Thank you 😄
If i'm finished i will give you the next example 😉

from espalexa.

ChristianKnorr avatar ChristianKnorr commented on August 30, 2024

I don't understand colorDevice->isColorTemperatureMode().
For the first time i change color or ct it is "1", and every next time(s) it is "0", but it doesn't matter it's colored or whited...

[before setup]
uint8_t iscolor1;
[...]
[in setup]
  device1 = new EspalexaDevice("Oberschrank rechts", colorLightChanged1, 0);
  espalexa.addDevice(device1);
[...]
[after loop]
void colorLightChanged1(uint8_t brightness, uint32_t rgb) {
  iscolor1 = device1->isColorTemperatureMode();
  Serial.print("iscolor1: "); Serial.println(iscolor1);
//  [up to here i want to separate witch 'if']
  uint16_t hue = device1->getHue();
  byte sat = device1->getSat();
  uint16_t ct = device1->getCt();
}

from espalexa.

ChristianKnorr avatar ChristianKnorr commented on August 30, 2024

Aaaargh sorry my failure 😁
what you can't see is the rest of my function in which i play with device1->setValue() and device1->setColor(hue, sat); so i haven't to wonder 😜

from espalexa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.