Microwave Motion sensor HB100


hi!
i'm new arduino, trying switch on led light when detects motion using hb100 microwave sensor.  it's easy programmed on ultrasonic motion detector but  kinda complicated on microwave motion sensor. want switch on led light when reaches frequency. came far , not work . appreciate if can me coding.

int pin=  7;
int led1= 13;
unsigned long time;
void setup() {
  // put setup code here, run once:
serial.begin(9600);
pinmode(pin,input);
pinmode(led1,output);

}

void loop() {
  // put main code here, run repeatedly:
int out= getfrequency(pin);
serial.print(out);
serial.print("\n");
if(out==-1)
{
  digitalwrite(led1,low);
}
else
{
digitalwrite(led1,high);
}
 long getfrequency(int pin) {
  #define samples 4096
  long freq = 0;
  for(unsigned int j=0; j<samples; j++) freq+= 500000/pulsein(pin, high, 250000);
  return freq / samples;
}
}



Arduino Forum > Using Arduino > Project Guidance > Microwave Motion sensor HB100


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'