Author Topic: Programming Started  (Read 6561 times)

0 Members and 1 Guest are viewing this topic.

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Programming Started
« on: January 11, 2009, 06:16:44 PM »
 I am still having a trouble understanding the arduino programming language to start off my robot.  So far I dont know if this is right or if this is where I am even supposed to start, but here is a little. ( agian for people who dont know I am trying to right the fifty dollar robot code in the arduino program)

int servoPin5 = 5;    //servo connected to digital pin 5
int servoPin6 = 6;    //servo connected to digital pin 6

void setup()
{
   pinMode(servoPin5, OUTPUT);   //sets pin5 as output
   pinMode(servoPin6, OUTPUT);   //sets pin6 as output


and if this is correct so far how to I go on

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Programming Started
« Reply #1 on: January 11, 2009, 06:29:56 PM »
right now your code just set up the pins to be output pins . Now you just control them using the code on this page: http://www.arduino.cc/playground/ComponentLib/Servo

Quote
The Software Servo Library can drive servos on all of your pins simultaneously. The API is patterned after the wiring.org servo library but the code is different. You are not limited to 8 servos, but you must call the Servo::refresh() method at least once every 50ms or so to keep your servos updating.

Standard Methods
attach(int)
    Turn a pin into a servo driver. Calls pinMode. Returns 0 on failure.
detach()
    Release a pin from servo driving.
write(int)
    Set the angle of the servo in degrees, 0 to 180.
read()
    return that value set with the last write().
attached()
    return 1 if the servo is currently attached.

Heres some sample code I just wrote , it should work - but then again I never use the Arduino language. Try it out

Code: [Select]
#include <Servo.h>

Servo servo1; // servo1 is now a servo object
Servo servo2; // servo2 is now a servo object

void setup()
{
  servo1.attach(5); // Set a servo pin to be pin 5
  servo2.attach(6); // set a servo pin to be pin 6

}

void loop()
{
servo1.write(90);  // set servo1 to go to 90 degree angle
servo2.write(45); // set servo2 to go to 45 degree angle
delay(15);           // wait 15 mS for the servo to get there
Servo::refresh();   //keep your servos updating
}
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Re: Programming Started
« Reply #2 on: January 11, 2009, 06:33:41 PM »
than what do you use to program your Roboduino

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Programming Started
« Reply #3 on: January 11, 2009, 06:57:18 PM »
Well, errr... You use Arduino software, right? There are buttons right below the menu bar, Upload to the board is the second from right to left if you hold the mouse over it it will say it's name.

But no offense, try to do some homework. Open Arduino software, go to Help menu, then click on Getting Started. Read the page that opens. Then go back to Help and click on Environment, then on Reference. Read all that. You will get an idea of how to use it.

After you've done all that, let us know what you want to do , try to write down how you think it should work and we will help you debug it. I really want to help you, but can't give you step by step instructions, takes too much time...
Check out the uBotino robot controller!

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Re: Programming Started
« Reply #4 on: January 11, 2009, 07:04:24 PM »
Quote
Well, errr... You use Arduino software, right? There are buttons right below the menu bar, Upload to the board is the second from right to left if you hold the mouse over it it will say it's name.

what I meant, is airman00 said he used something different to write his programs instead of arduino and I was wondering what it was. 

Well duh who wouldn't know where the button is to upload the program

Also I agree with you I need to do more homework I shouldn't be babied!

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Programming Started
« Reply #5 on: January 11, 2009, 08:13:19 PM »
than what do you use to program your Roboduino

Straight C , not the Arduino language. I only use the GCC compiler.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Programming Started
« Reply #6 on: January 11, 2009, 08:45:20 PM »
Well, I hope you're not offended.  :)

I worked all afternoon to debug some code (in Arduino) to be able to use AVRcam to center the pan/tilt head on an object I was movig in front of it. The centering part works, still have to fudge it a bit so it does not oscilate (a PID control would work nice, but I feel it won't be necessary in the end). The big problem is with the AVRcam seeing too many small objects in different places every time it takes a frame. Also the object I want to follow is eighter square or rectagle, has different size at the same distance but at different places in the frame. I am looking for the biggest object, but sometimes the cam it sees something else as the biggest object or not see an object at all. Not reliable. I seem to remember a couple of years ago when I bought it, it worked better on the computer. Now it is the first time I do something with it. It may be the fact that I live in a basement and there is little natural light in this room. I have a better room, but I can't work in there.

I managed to have the cam connected to the hardware UART on Roboduino (set at 115200 baud) and the serial LCD on a softwareSerial port (set at 9600 baud). At first the LCD was printing garbage until I did some tests and found out that the software serial port was declared twice, once by AVRcam library and once by my program. After I corrected it, it works flawless. I can see on the LCD the delta X and delta Y and the Ping value. Nice!

I think I should start to work on the chassis for this robot... I'll just use regular servos (continuous rotation of course) for driving at this time untill I'll have the I2C servo controller ready.
Check out the uBotino robot controller!

Offline frodo

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: Programming Started
« Reply #7 on: January 12, 2009, 10:35:38 AM »
what, so you can program the roboduino with C as well as arduino?
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Programming Started
« Reply #8 on: January 12, 2009, 11:01:48 AM »
what, so you can program the roboduino with C as well as arduino?
yep

Arduino language is derived from C , I just don't use the Arduino libraries and use the AVRlib libraries or write my own.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline frodo

  • Supreme Robot
  • *****
  • Posts: 329
  • Helpful? 2
  • BOW DOWN TO MY MIGHTY STARE!!
Re: Programming Started
« Reply #9 on: January 12, 2009, 11:04:44 AM »
oh right, that makes it more easy. come on msn please airman00, need to tell you something about the roboduino thing.
OMG!!!! I AM SUPREME ROBOT!!!

Check out my Web

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Re: Programming Started
« Reply #10 on: January 12, 2009, 06:38:07 PM »
Quote
Well, I hope you're not offended. 

I'm not I just didn't wan't you to think I was that stupid!

Quote
I only use the GCC compiler.

What does GCC stand for?

Also then isn't the AVR Program use C?

If that is true then I should beable to use Admin's hex file on Photovores for the fifty dollar robot and use my AVRISPmk11 to upload it to the Roboduino?

Offline Ro-Bot-X

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,431
  • Helpful? 25
  • Store: RoBotXDesigns.ca
    • Ro-Bot-X Designs
Re: Programming Started
« Reply #11 on: January 12, 2009, 09:13:50 PM »
If that is true then I should beable to use Admin's hex file on Photovores for the fifty dollar robot and use my AVRISPmk11 to upload it to the Roboduino?

Yes, you can! Airman00 was also working on a page for the $50 robot on Roboduino. It may be done allready, I didn't check to see, since I don't use plain C. I find it much harder and since I am not a good programmer, I like the ease of using libraries for everything. However, much work was done to add libraries to Axon for most of the functions I use so I may start to learn to code in plain C.
Check out the uBotino robot controller!

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Re: Programming Started
« Reply #12 on: January 13, 2009, 05:06:58 AM »
Whenever I get home from school i will be trying that.

Quote
Yes, you can! Airman00 was also working on a page for the $50 robot on Roboduino. It may be done allready

the last time I checked it wasn't he had some information but no pictures and nothing and the program part, but it is looking good

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Programming Started
« Reply #13 on: January 13, 2009, 08:00:46 AM »
Quote
Airman00 was also working on a page for the $50 robot on Roboduino. It may be done allready
I'm going on vacation in a few days , so I'll be sure to finish it up and take some pictures .

Also you might not even need a hardware programmer , and you would be able to use the Arduino bootloader to upload your .hex file.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Re: Programming Started
« Reply #14 on: January 13, 2009, 01:55:20 PM »
So i would follow the tutorial on the fifty dollar robot to set it up in AVR then how do I download it

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,650
  • Helpful? 21
  • narobo.com
    • Narobo.com - Mechatronics and related
Re: Programming Started
« Reply #15 on: January 14, 2009, 08:17:53 PM »
Wait literally a week and it will be done
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline RoBoTicSTopic starter

  • Full Member
  • ***
  • Posts: 80
  • Helpful? 0
  • Man is a robot with defects
Re: Programming Started
« Reply #16 on: January 15, 2009, 07:07:03 AM »
 :) Thank YOu for all of you help.  While I am waiting I will start a new project.

 

SMF spam blocked by CleanTalk