PIR SENSOR

hi guys how i can enable and disable pir sensor?

Too vague. Are you asking how you can write code to control whether input from a PIR sensor is monitored by the Arduino board?

hi my friend i have a project based on iot sector,i have use mqtt broker on ubuntu 16.04 lts and with my local ip and default port,my server connected with my phone.My problem is i cant enable or disable the pir sensor, i use callback function for this but i haven't found a solution.I want with pir sensor and relayfor to control an electrical outlet, in my case pir sensor works as input and realy works as output.How can i control only pir sensor? where pir sensor is enable then works as input and the system with relay runs with some pir values 0,1 if pir is disable the system didnt run.

You can’t ensble or disable a PIR, but you can write code to ignore its output or put some form of switch ( relay/transistor) to disconnect its output from what ever you have connected it too.

but i want the interaction pir-relay :(..in my case my code take a value and the relay become low or high.if i put the loop in client.loop and in callback function i put one if for relay high value and other if for relay low value i will have the results as i want"?

Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it’s OK to add it as an attachment. Don’t put your code in some external file service like dropbox, etc. We shouldn’t need to go to an external website just to help you. I do feel it’s reasonable to post a link to code hosted on GitHub or similar code hosting sites since that’s an platform specifically designed for this sort of thing

Please always do a Tools > Auto Format on your code before posting it. This will make it easier for you to spot bugs and make it easier for us to read. If you’re using the Arduino Web Editor then you will not have access to this useful tool. I recommend using the standard Arduino IDE instead.