Let's Make Robots!

From Picaxe to Arduino

When I joined LMR I had just written my first picaxe program. After 16 months I have finally crossed over to Arduino. The biggest problem I found was that all the commands were not in one neat package like the picaxe manuals (Manual 2 in particular).

After some Googling I found the "Arduino Programming Notebook" by Brian W. Evans. Although hardly an all inclusive guide it is a nice simple guide on the programming structure and common commands used. Perfect for an absolute begginer! Along with the examples built into the Arduino Enviroment I soon understood the basics.

Once I could make a LED blink and use PWM to dim it or vary the speed of a small motor I then found the reference page on the Arduino home site made more sense an became useful. With the odd Google search when I was stuck it wasn't long before I had translated "Mr. General.BAS" for use with an Arduino Nano plugged into Mr. General's breadboard.

Arduino users will have to forgive my poor program structure. This is partly because the program was an almost direct translation of a picaxe basic program and mostly because I was learning as I went. Those familar with the example code for "Tune" will see I am a plagiarist and copied the example with almost no change. 

I still have a lot to learn and still like picaxe for many things such as it's commands for using IR leds and receivers. For those picaxe programmers wanting to learn Arduino I found the Arduino Nano plugged into a breadboard was a great beginners platform at a good price.

IMG_0152.jpg

AttachmentSize
Programming_Notebook.pdf381.63 KB
Mr__General_Arduino.zip3.24 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Arduino does have a few strange programming "Qwerks" but the general flow and structure of the C based language makes life so much easier.

Arduino has some "Hidden" secret suprises toooo..........

Shhhhh. Dont tell everyone........... Arduino 328s have an internal temparature probe that can be read........

......stops you bake-ing your bot - or drive it out of the sun to prevent meltdown......

Totally agree. Arduino nano on a breadboard is great starting platform. I was wondering when you'd start with the arduino's

I stopped with the arduino nano when I got stuck trying to get the nano to communicate over a serial line with a picaxe (without using I2C). I'll have to get working on that again, one of these days. 

Since I got to China I just haven't had the time. Now that we have a customer who wants Arduino / AVR robots I no longer had a choice.

Without using I2C? I suspect the picaxe and arduino had trouble communicating because one wanted the signal inverted. I know that I had to invert the signals between the picaxe and the Xbee to get them talking.

 Other than that I found sometimes the Baud rate was not as expected (with the picaxe) due to things like clock frequency and the fact that some commands automatically change the clock frequency (and thus baud rate) to suit their needs.

I know I should be researching this before asking, but is there a simple way to invert those signals? Is ther such a thing as a signal inverter?
Sure is. For some strange reason i can't add picture to this post. I'll just link it: http://letsmakerobots.com/files/userpics/u668/Immagine_0.png

The components in the grey square are used for inverting the signal. I also opened a post about this not too long ago: http://letsmakerobots.com/node/16945

Also, remember that you can invert the serial from True to Inverted on the picaxe. If you rate the letter T before the baud rate you make it "true", while N makes it "inverted".

I tried a lot of combinations of baudrates and T or N, but none worked. I guess using an actual inverter will be next.

Thanks for the help 

Welcome Oddbot on the dark side ;-). You don't need to excuse for poor programming structures.  For me the code looks very well designed.
I now have the IO pin definitions as a seperate tab to make it easy for users to know which pin connects to what.

But I didn't want to offend the Arduino members. As for the structure, I have learned a few things as I wrote it and am now in the middle of re-writting it for a new version of Mr. G.

I like the tabs in the Arduino enviroment. I now use one for pin definitions on all projects so that a person using my code can easily see which pin needs to be connected to what without search the entire code. I will update the code soon with this extra tab.