Help using motion sensors

hi all ill jump right to the issue i have tryed both microwave sensors and PIR for some reason i get no response to actual movement but just a constant cycle of motion , no motion, motion etc any ideas what causes this

used mutiple sensors
tryed adding PI filter
code below ...


//Dead body FX
#include <Servo.h>
#include "SerialMP3Player.h"





#define TX 0
#define RX 1



SerialMP3Player mp3(RX, TX);
Servo Vertservo;  // create servo object to control a servo
Servo Horservo;


int pos = 0;    // variable to store the servo position
int Right = 180;
int Left = 90;
int R = 180;
int L = 90;
int Sensor = 13 ;
int State = LOW;
int Val = 0;
int Gled = 5;


void setup() {

  Serial.begin(9600);
  mp3.begin(9600);        // start mp3-communication
  delay(500);             // wait for init
  Serial.println("mp3-com completed");

  mp3.sendCommand(CMD_SEL_DEV, 0, 2);   //select sd-card
  delay(500);             // wait for init
  Serial.println("SD Storage Selected");


  Vertservo.attach(9);  // attaches the servo on pin 9 to the servo object
Horservo.attach(10);


  pinMode, Sensor , INPUT;
  pinMode, Gled, OUTPUT;
  delay(10000); /// int sensor
  digitalWrite (Gled, HIGH);
  Serial.println  ("PIR config completed") ;


}
void loop() {

  Val = digitalRead(Sensor);
  if (Val = HIGH);
  delay(200);
  Serial.println("Motion");
  mp3.play();
  Vertservo.write(150);
  delay(200);
  Vertservo.write(0);
  delay(100);
  Horservo.write(150);
  delay(200);
  Horservo.write(0);
  delay(100);

  if (Val = LOW)
    delay(200);
  Serial.println("no motion") ;
  mp3.stop();




}

Double oops

:rofl:

I can immediately see an unexpected ; tho what's the second oops :joy:

The "=" assignment.

Also probably missing some { }

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.