Subject:
|
Re: Sample bump sensor routine
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Tue, 4 Feb 1997 14:41:09 GMT
|
Original-From:
|
Fred G. Martin <fredm@^avoidspam^media.mit.edu>
|
Viewed:
|
1373 times
|
| |
| |
whether you use analog or digital ins, you don't need the 47k pullup
because the hb already has one. just wire the signal line to ground
through the normally open switch.
bill, i suggest you write your program without using the multitasking
features. i think you will gain a better sense of what's going on
that way. then the program becomes something like:
void main() {
while (1) {
forward(); /* subroutine to turn motors on so robot goes
forward */
if (digital(0)) { /* touch sensor plugged in here */
backward(); sleep(1.0);
left(); sleep(1.0);
}
if (digital(1)) { /* touch sensor plugged in here */
backward(); sleep(1.0);
right(); sleep(1.0);
}
}
}
you have to write the forward(), backward(), left(), and right() subroutines.
-Fred
|
|
Message is in Reply To:
| | Re: Sample bump sensor routine
|
| (...) Why would you use the analog ports for a bump sensor? Isn't that just a contact switch? Tie to a digital port pulled high with a 47K ohm resistor, and have the normally open contact tie the pin to ground when the contact switch is closed. The (...) (28 years ago, 4-Feb-97, to lugnet.robotics.handyboard)
|
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|