hello Forum
I am new and need help with my code. I have combined it from 2 codes to the best of my abilities, and have no idea why it does not work.
Basically the idea is when someone passes through the door, the door makes sound.
I have used XL MaxSonar 1200 motion sensor, Adafruit music shield and arduino UNO.
Please help as I have used all the wit I had already.
const int anPin = 0;
long anVolt, cm;
void setup() {
//This opens up a serial connection to shoot the results back to the PC console
Serial.begin(9600);
}
void loop() {
{
//Used to read in the analog voltage output that is being sent by the XL-MaxSonar device.
//Scale factor is (Vcc/1024) per centimeter. A 5V supply yields ~4.9mV/cm for standard range sensors
anVolt = analogRead(anPin); // this is for the standard range sensors
}
cm = anVolt;
Serial.print(cm);
Serial.print("cm");
Serial.println();
delay(100);
}
how to integrate it?