Back to Parent

Outcome


Outcome

    • Below is image of particle serial monitor showing the function triggered by applet and information on IFTTT activity page, as well as the completed code.
    • Also the video contains the process of operation.

Log ambient.thumb
Show Advanced Options
Show Advanced Options
Show Advanced Options

Debugging for simple ambient orb

Using dht sensor in dev 2 gave me a chance to interact with serial monitor and it helps a lot. (Here as well.) I added Serial.println whenever calling a function or when a part of code was executed to document the progress.
With screenshots of particle serial monitor, the process of coding for a simple is clearly kind of all related to the usage of millis();.

The first error was caused by missing part of code to initialize start time to set up the function using elapsed time for mapping brightness. Second one is also kind of a relevant mistake, caused by leaving out a initialization for fading back.

Cli2.thumb
Show Advanced Options

And finally, the particle serial monitor is listening to the fading speed of the argon and counting the the times that the fading functions is activated.

Cli3.thumb
Show Advanced Options

Coding process for simple ambient orb

The first idea is to create a function like calling out colors and let the strip fade. A fade function that use the logic of setColor, with the help of mapping overall brightness using elapsed time to evaluate the current progress.

With a function of void fade(uint32_t oColor, uint32_t dColor, bool refade), and call strip.Color containers w and r, it actually combines a void fade () with a void refade().  

The complete code for a simple orb is as followed. And the function could work when called on particle console.

Show Advanced Options

However, IFTTT trigger the Orb but returning timed out error. After discussing with Zhenfang I tested with the setColor function to check my settings for IFTTT and it actually works. So the question may be resulted from calling and waiting for return in the ambientOrb function that takes longs than the maximum website server waiting time. So the change needed is to remove the call and response outside of the particle function that works with web hook, replaced with a bool that serve as a flag to trigger the fade functions.

Ifttt status.thumb
Show Advanced Options

Reflection

When bump into errors, testing with different parts of code to check the external settings could work as a way of debugging.

Serial monitor is also an important reminder of certain part of code that was neglecting or wasn't executed.

Drop files here or click to select

You can upload files of up to 20MB using this form.