Software > Software

Programing help!!!

(1/3) > >>

NOOBinDistress:
After the 50 dollar robot I intend on starting another robot like project!!! YAAAAY. I need help with programing! I need to know how to be able to program 2 servos and a sensor. The sensor has to sense motion then wait 60 seconds and then tell both servos to move for about 5 seconds (I will have to be able to test around with the exact amount of time). And thats it! I know I cant ask anyone to do this for me because "your here to help, not build the bot for me". So if Anyone could tell me or help me program this myself!!! Ok please help me!! thanks.

Admin:
you will need to use timers

I dont have $50 robot source code for timers at the moment . . . but Im sure someone does and will post it (hint hint)

Do a google search on atmega8 timer sourcecode . . .

rgcustodio:
I'm assuming you have a correct installation of WinAVR (or gnuavr). WinAVR includes avr-libc which is a set of libraries that'll make your life definitely easier. It has several macros that deals with delays.

First include delay.h into your source code then add a call to delay_ms().

Lookie here for details:
http://www.nongnu.org/avr-libc/user-manual/group__util__delay.html

Goodluck!

- Rommel

Admin:
rgcustodio, I actually misread his post at first too, thinking he wants delays.

but actually he wants his robot to be active for X seconds, then swap to a different task for another Y seconds.

but yea, avrlib should have the timer functions you want . . . and it has some example code, too

rgcustodio:

--- Quote ---but actually he wants his robot to be active for X seconds, then swap to a different task for another Y seconds.
--- End quote ---

Actually you can do something like that using comparators and interrupts. Look into the PWM code of orangutan-lib.

- Rommel

Navigation

[0] Message Index

[#] Next page

Go to full version