A friend challenged me to build a robot with things lying around my house, claiming I couldn't do it. I decided on an arduino-powered one-wheeled robot which would sit idle until something was placed in front of its sharp IR rangefinder, then due to only one wheel turn in circles. The wheel is driven by a stepper motor I got from an old scanner. What follows is my actual problem.
As this is a junkbot and I have no wheels lying around I am forced to use cardboard discs, similar to what was done in the $50 robot tutorial. The motor will turn, and even turn the wheel, but as soon as I put it on the ground the friction causes the motor to stall. Any suggestions? Has my friend finally beat me?
Here's my code:
#include <Stepper].h>
#define STEPS 100
Stepper stepper(STEPS, 8, 9, 10, 11);
int Val = 0;
int irReader = 1;
int irMax = 100;
int beepPin = 2;
void setup()
{
stepper.setSpeed(75);
pinMode(irReader, INPUT);
pinMode(beepPin, OUTPUT);
Serial.begin(9600);
}
void loop()
{
Val = analogRead(irReader);
if(Val >= irMax){
digitalWrite(beepPin, HIGH);
stepper.step(-200);
}
}