š¬ What's all the fuss about?
-
Hello! Forgive me if I bother you, or if I ask some stupidity ... but I wanted to ask you something I can not find anywhere.
I already have a Relay node and a Sensor Node with a gateway running. I am using MYSController. Everything works OK.
I have concerns about some code syntax.
I can not finish understanding regarding the reading or writing of states in a binary device the syntax:state? RELAY_ON: RELAY_OFF
or
state? "true": "false"What does the "?" Mean. How should I understand that line? Because there are times when it appears inverted:
state? RELAY_OFF: RELAY_ON
or
state? "false": "true"Thank you!
-
@matias_sams said in š¬ What's all the fuss about?:
state? "true": "false"
It's known in C language as conditional operator
https://en.wikipedia.org/wiki/%3F:#C -
To add to the previous answer, in the relay example sketch, ? is used to handle that some relays are active low, some are active high.
From the sketch:
#define RELAY_ON 1 // GPIO value to write to turn on attached relay #define RELAY_OFF 0 // GPIO value to write to turn off attached relay -
!!!
Thank you very much community, you are great! -
Hi, I'm working on project of mobile app to measure the CO2, LPG gas , Smog through MQ135 and MQ7 sensors. Kindly help me what should I do??
Give me suggestions....Thank you -
Hi, I'm working on project of mobile app to measure the CO2, LPG gas , Smog through MQ135 and MQ7 sensors. Kindly help me what should I do??
Give me suggestions....Thank youWelcome to the MySensors forum @talhayounis
Th best way to get started with MySensors is to first read the getting started guide. Then you can move on to https://www.mysensors.org/build/gas which has an example sketch to use with MQ135 and MQ7.
The best way is usually to get a gateway and a simple node running, and then expand from that.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better š
Register Login