Society of Robots - Robot Forum

Software => Software => Topic started by: dr_kaos on November 13, 2009, 10:02:51 AM

Title: newbie needs programming help...please
Post by: dr_kaos on November 13, 2009, 10:02:51 AM
Hi,
i am very new to the arduino world, it is truly fascinating what you can do with it.
unfortunately, I cannot, lol
what i am trying to do is build a differential drive controlled by wii nunchuck.  i have all the physical components (not really, motor controll hasn't arrived yet), if someone could please help me out (i dont know how to code yet).  i can slightly modify code, i can do the blinky LED sketches etc, this is just a little over my head.  i have seen many others doing this.  i can access the data off the nunchuck i just dont know how to write the code to send that to the controller (using a sabertooth 2x5).
Thanks in advance to any replies
dr_kaos
Title: Re: newbie needs programming help...please
Post by: z.s.tar.gz on November 15, 2009, 08:17:25 PM
Unfortunately, you're going to have to learn to program. There really isn't a way around it.
I don't know much about the arduino, but I do know that copy/paste/modify can only take you so far.
Maybe try something less complicated first to get feet wet?
Title: Re: newbie needs programming help...please
Post by: awally88 on November 15, 2009, 11:11:24 PM
Arduino is pretty easy, you said you have the nunchuck libraries. If you haven't done much programming before you should start simple.

Control some motors through a motor driver, start with one and make it run for 5 seconds, stop for 5 and loop.

After you can do that try to control a single motor with the nunchuck output. Each value is stored in 2 bytes so you get a number from 0 - 255 reading from teh nunchuck for the joystick, accelerometers and a true false from the buttons press. Basically have something that says:

if acc > 128 runmotor
else stopmotor

after you can do that you can start implementing steering algorithms from different readings from the data, do some pwm speed control, make something nice.

Also you might want to do some more general programming, C is better for robotics but java, python etc will help out your programming skills which will be transferable to C when you want them.  Buy a book or read online tutorials, it will help you out a lot.
Title: Re: newbie needs programming help...please
Post by: dr_kaos on November 16, 2009, 12:22:28 PM
Thanks for the replies, i have purchased one book, but motor control isn't touched upon really.  but after some research i have realized it isn't really that difficult.  i am definitely going to take your advise though and scale down my ambitions and work back up.  i unfortunately have forgotten C, and C++ (went far too long without using and it just dissapeared) so it's just like starting over for me.
Title: Re: newbie needs programming help...please
Post by: awally88 on November 17, 2009, 06:35:37 AM
I wouldn't worry about it, it should really only take you a few days to get up to scratch on the basics and arduino code is very high level code!

Something else you might want to look at is a another very high level coding language called 'processing' its similar to the arduino environment and you can make amazing gui's and special effects really easily i.e. a rotating cube in about 3 lines of code. It might be something nice to play with to help you get back into coding.