Changing ON status to OFF status and vice versa

Hello. I am very new with ESP32/Arduino, Firebase and MIT app. I have a question regarding to my project. I'm making an app that can monitor temperature and humidity from smartphone. And when the temperature increase until certain degree, the fans will automatically on.
I have finished the coding (combination from multiple tutorial on YouTube) and the basic of blocks for monitoring the temperature and humidity. But I don't know how to make a block to show one line that can tell "Fans condition: ON or OFF".

my code is simply like:
if temperature >= 40, then the fans on
if temperature <40, then the fans off

This is my blocks and design so far.


Hope anyone can help me. Sorry if my English is bad

blocks

1 Like

Your FireBase DataChanged Event should have the same blocks as your FireBase .GotValue Event block.

It makes no sense to ask for more data when data has changed, without using the new values.

Also, I am concerned with those '/' prefixes in your tags. You should not need them if your ProjectBucket is set right, and they might be stripped when arriving in event tags.
(not sure about that.)

P.S. I imagine your Arduino controls the fans. Shouldn't it then also update Firebase like it does for temperature and humidity?

2 Likes

So if these 2 blocks are same, it will continuosly recieve and update the sensor value right?

I am not sure because I just copied all the steps from YouTube.

Yes my Arduino code controls the fans. But I made a variable called FanStatus that is 0 when the fans off, and when the fans on, FanStatus will be 1. So I want to change the number 0 as OFF and number 1 as ON in MIT app

image

1 Like

the variable LED1 is actually the fans but I'm too lazy to change its name