Go Down

Topic: Programing an ATmega328 with a Leonardo (Read 475 times) previous topic - next topic

chinusta

Hi guys. I am very, very new to this whole micro controller thing. I have no background in programming at all, and am barely starting with this. I was about to purchase an Arduino UNO, but I saw that the new Leonardo came out. I have read things from both sides. Some claim that it is good and others that the UNO is better. My question is if you can program the ATmega328 with the Leonardo? that is to put the ATmega328 on a breadboard and connect it to the leonardo to I guess "burn code" is what is called?

Again sorry if this sounds like a stupid question. My main purpose to work with Arduino is because I have read and heard that it is an easy tool for beginners to use. What I would like to build is a matrix of LEDs that would respond to movement. Have LEDs that will light up when you move your hand over them. What I am thinking is using lets say for every 4 white LEDs have one infrared with an infrared detector. What I have read so far is that you can make a larger array by just programming several ATmega328 since one arduino will limit you to only a few. (I want a wall like this.) And since the Leonardo has a surface mounted chip, it will be more difficult to work with.

What will you recommend me to buy??? The UNO? The Leonardo? or both? Again I would like to stick with the Leonardo if it does what I need.

Thank you guys!

Nick Gammon

To answer your first question, I don't see any real reason why you couldn't program an Atmega328 with a Leonardo, but somehow this seems to be making things harder for yourself than they have to be.

The bulk of the publicly-available libraries will work on the Uno because they were written for it (or its predecessors), whereas the Leonardo has a different processor on it. There will be some differences, in particular with libraries or sketches that try to directly address ports.

The thing is, if you buy a Leonardo and develop a sketch, and then try to program that same sketch onto a bread-boarded Atmega328 it may not work. You switched processors. Especially if you are a beginner I would stick to one chip, and for maximum support, library usage, etc. I would get a Uno.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

chinusta

Thank you very much. I went with your advice and just made the purchase! I'm very excited for this :D
I had not thought about the libraries and tutorials that are already available for the UNO. That is a big plus for a beginner.

spcomputing

You will not be disappointed.  As Nick points out, everything is centered around the Arduino Atmega328.  The others have extra capabilities but can be "quarky".  The Leonardo is a nice platform, but it is not an Uno.  It is a little "clunky" switching CDC modes and can hang up.  Serial communications through the USB are different and on some machines (PC side)so they don't work.  Leonardo needs a little more development, but so did many of the Uno precursors.

First, Uno, then play ;)
http://www.spcomputing.com

chinusta

Yeah I should have know better. I guess I just went with the whole "its new so it must be better" Its probably better for production, but as a starter kit I guess I'm better off with something that people can help me with and something that has tons of tutorials online. :)

spcomputing

Everyone here has been in your shoes at one time.  All I can say is that some have swapped their Mega2560 for two Uno's and couldn't be happier.

Later, when you need keyboard and mouse control with a board, the Leonardo will be there.

Have fun.
http://www.spcomputing.com

Go Up