Subject:
|
Re: clueless programmer
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 26 May 1997 14:19:19 GMT
|
Original-From:
|
Bill Conroy <conroyw@acm.[Spamcake]org>
|
Viewed:
|
1785 times
|
| |
| |
A very simple program which will exercise the motors in this
configuration is listed. The first section will put a message on the LCD
then wait until the sopt button is pressed. Once the stop button is
sensed, it will turn on the motor in port 0. Next the board goes to
sleep for approximately seconds. During this time, the motor is still
running. Next all motors are turned off. The board goes through the
same sequence with the motor in the reverse direction. Next it puts a
message on the LCD and waits for the start button and repeats the
sequence for the second motor.
This is a very simple example of running the motor. I real practice, I
do use it this way except when teaching my son initially how they worked.
Specific problems with the code include the single threaded nature of
the code. You don't necessarily want to the board to go to sleep while
your creation is motoring around. Later tonight I will put up a piece of
code to use the multiprocessing features of the board.
<bigger>void main()
{
printf("Press stop button\n"); /* message to LCD */
stop_press(); /* wait for stop button */
fd(0); /* command to make motor port 0 turn on in forward direction
*/
sleep (2.0); /* wait here for 2 seconds*/
ao(); /* turn off all motors */
bk(0); /* command to make motor port 0 turn on in reverse direction
*/
sleep(2.0); /* wait here for 2 seconds*/
ao(0);
printf("Press start button\n" );
start_press();
fd(2);
sleep (2.0);
ao();
bk(2);
sleep(2.0);
ao(0);
}
</bigger>
> Date: Sat, 24 May 1997 16:13:07 +0100
> From: Randy Eaton <<defreese@gate.net>
> Organization: STUDENT
> To: Bill Conroy <<conroyw@acm.org>
> Subject: Re: clueless programmer
>
> Mr. Conroy ,
>
> Thanks for answering so soon. I don't have
> much knowledge w/ the handyboard or programming.
> I have the left motor in port-0- and the right in
> port-2-. The touch sensors (they are made by LEGO)
> are left sensor in port-7- the right sensor in
> port-8-. I also have a cadmium-sulfide photocell
> from Radio Shack but it's not wired in yet and I
> don't know the specs on it. I'll try it later. I
> have copied other programs but don't understand
> much of what I'm typing.
>
> THANKS,
> RANDY
>
>
William F. Conroy III conroyw@acm.org
Lt Col, USAF
Chief, Software Development IPT
Theater Battle Management Core Systems
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|