Question
Can someone change the following c++ code to Python please. It is a code I am using for the SEN0192 microwave sensor using an arduino
Can someone change the following c++ code to Python please. It is a code I am using for the SEN0192 microwave sensor using an arduino uno but now I have to use it with a raspberry pi but don't have enough time to learn phython. Thank you.
#include
} void loop() { Serial.println(number); // Printing the number of times of interruption, which is convenient for debugging. delay(1); if(state == HIGH) //When a moving object is detected, the ledout is automatically closed after the light 2S, the next trigger can be carried out, and No need to reset. Convenient debugging. { delay(2000); state = LOW; digitalWrite(ledOut, state); //turn off led }
} void stateChange() //Interrupt service function { number++; //Interrupted once, the number +1
}
void Handle() //Timer service function { if(number>1) //If in the set of the interrupt time the number more than 1 times, then means have detect moving objects,This value can be adjusted according to the actual situation, which is equivalent to adjust the threshold of detection speed of moving objects. { state = HIGH; digitalWrite(ledOut, state); //light led number=0; //Cleare the number, so that it does not affect the next trigger } else number=0; //If in the setting of the interrupt time, the number of the interrupt is not reached the threshold value, it is not detected the moving objects, Cleare the number. }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started