Author Topic: Programing help!!!  (Read 4033 times)

0 Members and 1 Guest are viewing this topic.

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Programing help!!!
« on: June 10, 2007, 07:37:01 PM »
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.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Programing help!!!
« Reply #1 on: June 11, 2007, 07:29:28 AM »
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 . . .

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: Programing help!!!
« Reply #2 on: June 11, 2007, 09:05:34 AM »
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
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Programing help!!!
« Reply #3 on: June 11, 2007, 09:09:31 AM »
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

Offline rgcustodio

  • Robot Overlord
  • ****
  • Posts: 217
  • Helpful? 0
  • Use "Search" and ye might find answers!
Re: Programing help!!!
« Reply #4 on: June 11, 2007, 09:29:28 AM »
Quote
but actually he wants his robot to be active for X seconds, then swap to a different task for another Y seconds.

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

- Rommel
« Last Edit: June 11, 2007, 09:30:46 AM by rgcustodio »
The best thing one can do when it's raining is to let it rain. - H. W. Longfellow

understanding is the path to enlightenment

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Programing help!!!
« Reply #5 on: June 11, 2007, 05:59:16 PM »
Alright thanks. I will try that out when my board is ready... Also Can you use a rs232 thingy and will that be able to do the same task?

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Programing help!!!
« Reply #6 on: June 17, 2007, 08:00:30 AM »
one more question.... should I try to buy a book that may teach me how to make a source code like this or meybe one that already has one... Thnks.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Programing help!!!
« Reply #7 on: June 19, 2007, 06:28:23 PM »
Quote
Can you use a rs232 thingy and will that be able to do the same task?
The rs232 thingies are for transmitting data to and from your PC.

Quote
should I try to buy a book that may teach me how to make a source code like this or meybe one that already has one
I recommend both reverse engineering source code as well as buying a book and/or reading tutorials on C programming (search this forum for both).

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Programing help!!!
« Reply #8 on: June 19, 2007, 06:45:27 PM »
b4 I do so which one of those is most worth while to learn about... I want to know which to start with if I m using avr...

Offline Eco19R

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Programing help!!!
« Reply #9 on: June 19, 2007, 07:05:05 PM »
I am not sure if you know all the steps from writing a program to inputing it into the MCU - so here they are


1. Write a program, to do that you need a compiler that creates code for the MCU you are using - ( I use PIC chips and I like Pic Basic Pro - it does everything I need it to do and its fairly simple which is a good thing).

2. Compile the program once its written using the compiler you have.

3. Program the MCU using a programmer that is capable of programming the MCU you created the program for. (I use Melabs USB programmer which I purchased from them for 100$ which works with most PIC chips)

So if you have extra cash (400 dollars worth) I would recommend you purchase Pic Basic Pro along with the USB programmer if you want to use PIC chips - it will all work together and has been tested many times before. - I am sure admin can direct you to the correct Compiler and Programmer for AVR chips 

http://www.melabs.com/


« Last Edit: June 19, 2007, 07:06:00 PM by Eco19R »

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Programing help!!!
« Reply #10 on: June 19, 2007, 07:24:48 PM »
yah umm... right now 400 bucks sound like alot :o! I might back away from that offer for a little while ;D

Offline Eco19R

  • Full Member
  • ***
  • Posts: 104
  • Helpful? 0
Re: Programing help!!!
« Reply #11 on: June 19, 2007, 07:45:50 PM »
The process is the same no matter what  Compiler and programmer you use

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,659
  • Helpful? 169
    • Society of Robots
Re: Programing help!!!
« Reply #12 on: June 19, 2007, 08:09:35 PM »
CCSC is a much cheaper C compiler and I highly recommend it . . . but its still kind of expensive . . .

I would recommend just using AVR cause compilers are free. (search the forum about it)

Offline sotu

  • Supreme Robot
  • *****
  • Posts: 350
  • Helpful? 0
  • ´BB - Eye Biped Bot
Re: Programing help!!!
« Reply #13 on: June 21, 2007, 01:30:22 AM »
Do you have the microcontroller for the robot yet?
How to build a biped bot:

Offline NOOBinDistressTopic starter

  • Robot Overlord
  • ****
  • Posts: 209
  • Helpful? 0
Re: Programing help!!!
« Reply #14 on: June 21, 2007, 08:47:25 AM »
No but I have the parts to make another 50 buck robot board I was hoping that would work.

 


Get Your Ad Here