go_away

Author Topic: I want to build stampy  (Read 1061 times)

0 Members and 1 Guest are viewing this topic.

Offline RoboChanTopic starter

  • Full Member
  • ***
  • Posts: 77
  • Helpful? 0
I want to build stampy
« on: June 24, 2009, 11:27:50 AM »
Ok i want to build a Stampy like robot. I have 2 DC motors that are very powerful and very Small (from those powerwheels toys). I just want to know is the Duemilanove and the motor shield good for 2 DC motors, a servo, a Sharp IR, and maybe 2 photoresistors. I want is to do what stampy dose but also stay in side a black ring. Can it be programed using arduino or should i use AVR and buy a programmer?

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: I want to build stampy
« Reply #1 on: June 24, 2009, 02:30:25 PM »
yep, an arduino can do it...
you could have the sharp ir run admins stampy code while the photoresistors watch for the line,
if line detected, back up for a second and turn or the like.
Howdy

Offline RoboChanTopic starter

  • Full Member
  • ***
  • Posts: 77
  • Helpful? 0
Re: I want to build stampy
« Reply #2 on: June 24, 2009, 02:50:22 PM »
Cool. How can i convert the stampy code to arduino code and how do i implement the photoresistors to the code??

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots
Re: I want to build stampy
« Reply #3 on: June 24, 2009, 03:01:07 PM »
The $50 Robot has my Stampy code (Sharp IR upgrade), which uses the same exact microcontroller as the Arduino.

Offline RoboChanTopic starter

  • Full Member
  • ***
  • Posts: 77
  • Helpful? 0
Re: I want to build stampy
« Reply #4 on: June 24, 2009, 03:12:46 PM »
Do i have to download the AVR porgrams to veiw the code or is there any stampy code in arduino?

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: I want to build stampy
« Reply #5 on: June 24, 2009, 03:59:55 PM »
find the $50 robot sharp ir tutorial, the code is in there.
you may have to get avrstudio...
Howdy

Offline RoboChanTopic starter

  • Full Member
  • ***
  • Posts: 77
  • Helpful? 0
Re: I want to build stampy
« Reply #6 on: June 25, 2009, 09:42:37 AM »
i cant open the code. How do i look at the code with AVR? Theres a note pad doc. MAIN.
Code: [Select]
//www.societyofrobots.com December, 2006

#include "cereb104.h"
#include "Utilities.h"


signed long int scan_angle=0; //angle of IR servo
unsigned int target_distance=0; //distance away of target
unsigned int distance_thresh=30; //acceptable target detection


//sense
void scan()
{
//swap scan directions

/*psuedocode
while object is detected
scan left while object detected
while object not detected
scan right until object detected*/

target_distance = analog(A3);//check sensor

if (target_distance > distance_thresh)//object detected
{
if (scan_angle>-20) //overflow protection
scan_angle-=1;//scan left
}
else //object not detected
{
if (scan_angle<130) //overflow protection
scan_angle+=1; //scan right
else //if scanned all the way, this forces it to start over
scan_angle=-20;
}

//servo scan code
output_bit(PIN_D2, 1);//139 center
long_delay_us(130+scan_angle);
output_bit(PIN_D2, 0);

//printf("angle: %ld distance: %u\r\n", scan_angle, target_distance);//debug code
}


void main() {

//initializing all Cerebellum routines
cereb_init(0);
pwm_init();

//allow short capacitor charge up time
delay_us(5000);

ScanLeft(); //reset IR scanner to straight

//system ready indicator, and start button
set_led(YELLOW, 1);
while(analog(A3) < 100) {printf("%u\r\n", analog(A3));}; //hand swipe to activate robot
set_led(YELLOW, 0);

servoReverse();

while(1)
{
delay_us(2500);//so it doesnt change states too fast //2500 works

scan();//locate target


//movement actions
if (scan_angle > 85)//if target is too far on right
{
servoRight();//turn towards target
set_led(YELLOW, 0);
set_led(GREEN, 1);
scan_angle-=1;//scanner turns left while robot turns right
}
else if (scan_angle < 50)//if target is too far on left
{
servoLeft();//turn towards target
set_led(YELLOW, 1);
set_led(GREEN, 0);
scan_angle+=1;//scanner turns right while robot turns left
}
else //centered on target
{
servoForward();//drive straight
set_led(YELLOW, 1);
set_led(GREEN, 1);
}
}

while(1);
}

//thoughts, try reducing the 5000 delay, maybe doubling negative scan_angle, and reducing turning speed
I tryed looking for arduino sumo robot code but i can't find any. Has anyone ever build a sumo robot with arduino??

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,653
  • Helpful? 169
    • Society of Robots

 


Get Your Ad Here

data_list