In this exercise, we have programmed the brightness and darkness with exact amounts, thank you. Thanks to the thresholds function, specifically we have set a brightness of 200 and we have programmed the darkness with an exact amount of 50. Subsequently we have included that if the indicated brightness amount is exceeded, a black LED turns on, and it Same with darkness, if the amount of 50 is exceeded, we have indicated to turn on a white LED.
JSON code:
{ "do": [ { "thresholds": { "bright": 200, "dark": 50 } }, { "on": { "do": [ { "light": { "color": 0, "duration": 1 } } ], "event": "bright" } }, { "on": { "do": [ { "light": { "color": 1, "duration": 1 } } ], "event": "dark" } } ]}
Lesson 1: Actions
This code, when we start it, what it executes are two actions, one is to turn on a white LED and the other function is to make a sound, when this code is executed, these two actions will be done at the same time.ELIO PLAY JSON code