12VDC Chime and motion sensor

I have hooked up a motion sensor and a 12VDC Chime to my Arduino. I don’t have any problems uploading the code but the chime rings continuously. It does not seem to be variable to the motion sensor. Below is the code that I have used…

int switchState = 0;
void setup() {
pinMode(10, OUTPUT);
pinMode(7, INPUT);


void loop() {
switchState = digitalRead(7);

if (switchState == LOW) {
digitalWrite(10, LOW);
else {
digitalWrite(10, HIGH);


No, sorry, no suggestions. That sketch should work.

Could you do a test with a button (button with resistor or INPUT_PULLUP) and the system led at pin 13 ?
Next try the motion sensor with the system led.
It is something in the hardware. I hope you didn't damage something. Some 'chimes' are coils with very low DC resistance.

When a project is not working, test everything one by one. That way you also learn along the way how it behaves. For example the PIR sensor might have an open collector output, or an output signal that is too low for a 5V Arduino.