Go Down

Topic: Question about my Sketch. (Read 1 time) previous topic - next topic

OmegaRa



I would recommend removing the indicated *** lines in setup,  Compile and run, the motor should go on 4 seconds and then off 4 seconds, on 4, off 4.  Then in loop() just change the leftMotors()s to rightMotor().  You're just making sure the motor works here.
Also see if you can add the lines in the loop, to test the reverse:
  right fwd full
  delay
  right fwd 0    (stop)
  delay
  right reverse full
  delay

Modify for both motors fwd, 1 fwd 1 reverse, half speed (128), etc.

Make sure you understand the concept that setup runs once, first-- and loop then runs forever, over and over.

Cheers,
John


Okay, I did all that and got the motors working, not both at the same time, but I got each motor to go forward and backward, and switching back and forth.

GoForSmoke

You could bury a powered cable under the lawn and use a magnetic field sensor or two on the mower to follow that like a toy line-follower robot. You'd get a perfect path every time regardless of wheel slip, etc. No map or mapping required, just one long piece of single conductor wire and some time making and filling very thin, shallow trenches.

Could probably run something like that with a Tiny.

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

OmegaRa


You could bury a powered cable under the lawn and use a magnetic field sensor or two on the mower to follow that like a toy line-follower robot. You'd get a perfect path every time regardless of wheel slip, etc. No map or mapping required, just one long piece of single conductor wire and some time making and filling very thin, shallow trenches.

Could probably run something like that with a Tiny.




This is more or less the plan eventually. Right now I am just going to use it in my backyard, which is fully fenced in, so I don't need sensors yet, just bumpers to make it turn around should it run into anything.

OmegaRa

here are links to a couple pictures of what it looks like so far

http://sdrv.ms/14EWuxa

http://sdrv.ms/14EWqxI

http://sdrv.ms/14EWyNz

I have to properly mount the Board and give it some paint...but overall that is it, minus it's covers

UKHeliBob


Okay, I did all that and got the motors working, not both at the same time, but I got each motor to go forward and backward, and switching back and forth.

Did they fail to run at the same time or was that how you programmed it ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Go Up