arduino uno
hey have sensor detects motion , going use project im kinda stuck in how should program it?
i got toy tank going detect motion motion detector sensor , want sweep acroos every 90 degrees , stop 10 seconds , move again, once detects want stop , use ping sensor sensor stop @ distance shoot bbs.
so far have wote motion detector test out problem how should able use motion detector sensor in application c code, appreciated.
im going put example of code show how writen!
by way im using xband motion detector
my program:
void setup() {
serial.begin(9600);
serial.println("pulse test");
pinmode(13, output);
attachinterrupt(1, inthandler, change);
}
volatile int pulsecount = 0;
void inthandler() {
pulsecount++;
}
void loop() {
if (pulsecount > 2) {
digitalwrite(13, high);
if (pulsecount > 3) {
serial.print("motion! ");
serial.println(pulsecount);
}
digitalwrite(13, low);
}
if (pulsecount > 0 && pulsecount <= 3) {
serial.println(pulsecount);
}
pulsecount = 0;
delay(250);
}
i got toy tank going detect motion motion detector sensor , want sweep acroos every 90 degrees , stop 10 seconds , move again, once detects want stop , use ping sensor sensor stop @ distance shoot bbs.
so far have wote motion detector test out problem how should able use motion detector sensor in application c code, appreciated.
im going put example of code show how writen!
by way im using xband motion detector
my program:
void setup() {
serial.begin(9600);
serial.println("pulse test");
pinmode(13, output);
attachinterrupt(1, inthandler, change);
}
volatile int pulsecount = 0;
void inthandler() {
pulsecount++;
}
void loop() {
if (pulsecount > 2) {
digitalwrite(13, high);
if (pulsecount > 3) {
serial.print("motion! ");
serial.println(pulsecount);
}
digitalwrite(13, low);
}
if (pulsecount > 0 && pulsecount <= 3) {
serial.println(pulsecount);
}
pulsecount = 0;
delay(250);
}
hey have xband motion detector sensor , want use servo , ping sensor activated when motion detector detects motion far got motion detector im kinda stuck implement servo , ping activvated, would appreciated or advice, or mentors can guide me project im building!
thanks in advance!
program code:
void setup() {
serial.begin(9600);
serial.println("pulse test");
pinmode(13, output);
attachinterrupt(1, inthandler, change);
}
volatile int pulsecount = 0;
void inthandler() {
pulsecount++;
}
void loop() {
if (pulsecount > 2) {
digitalwrite(13, high);
if (pulsecount > 3) {
serial.print("motion! ");
serial.println(pulsecount);
}
digitalwrite(13, low);
}
if (pulsecount > 0 && pulsecount <= 3) {
serial.println(pulsecount);
}
pulsecount = 0;
delay(250);
}
thanks in advance!
program code:
void setup() {
serial.begin(9600);
serial.println("pulse test");
pinmode(13, output);
attachinterrupt(1, inthandler, change);
}
volatile int pulsecount = 0;
void inthandler() {
pulsecount++;
}
void loop() {
if (pulsecount > 2) {
digitalwrite(13, high);
if (pulsecount > 3) {
serial.print("motion! ");
serial.println(pulsecount);
}
digitalwrite(13, low);
}
if (pulsecount > 0 && pulsecount <= 3) {
serial.println(pulsecount);
}
pulsecount = 0;
delay(250);
}
Arduino Forum > Using Arduino > Project Guidance > arduino uno
arduino
Comments
Post a Comment