NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Programming with graphics

November 19, 2014
by jmuthe
jmuthe's Avatar

One project that I would like to try is that I would like to create a program where a user is shown a blank sheet music on their computer screen and then they could create their own sheet music on the screen. Once the user creates a sheet music for their song, the song information would transfer to the microcontroller and then the microcontroller would play that song on a speaker.

In this following thread http://www.nerdkits.com/forum/thread/2802/ I was explained how to transfer information from text files to the microcontroller. However, I want to create a code that would actually generate an image, which would be the sheet music, and transfer that information to the microcontroller. Therefore, I need to know how to use code to create images.

Firstly, what is the best programming language to do this? Since I am learning C for the Nerdkit, then C language would be best for me and if it is possible to do this in C then I will use C. I also saw some Youtube videos of people using C to make graphics so I think it is acceptable. However, if you think that it would be more practical to learn another programming language to do this, then let me know. Secondly, what compiler would be good to use these graphics? Thirdly, what book would you recommend for a beginner trying to learn to program using graphics?

November 20, 2014
by Ralphxyz
Ralphxyz's Avatar

I would look at Python it has some very robust graphics programming available plus a great community to help, they like challenging questions.

November 21, 2014
by jmuthe
jmuthe's Avatar

When somebody has to program with graphics, could they do the same things in C programming that they could do in Python or are there some graphic functions they could do in Python that they can't do in C programming. For example, if I want to create the program with the sheet music graphic, would it be possible to do it with C or possibly C++? I only ask because, like I said in the first post, I know a little about C and even c++ but know nothing about Python. However, if it is impossible or extremely hard to do in C/C++ then I would be willing to learn Python.

November 22, 2014
by Ralphxyz
Ralphxyz's Avatar

C does not have the graphic libraries, at least not natively you might be able to find some.

C++ is more than capable.

Python is just easier, spoken by a person who has little Python experience but what I have done worked great and was relatively easy to learn.

November 22, 2014
by JimFrederickson
JimFrederickson's Avatar

There is "learning C" and then there is "learning C for the environment you are
programming for".

In programming in C for the Microcontroller "C" is the singly most dominant element.

The "environment your are programming for" is the Micrcontroller and it's very limited,
albiet quite capable, resources.

Any "Programming Environment" has an set of "API's". ("Application Programming
Interfaces".)

These are, essentially, standard functions that can be used to get the Environment you
are programming for to perform certain tasks.

The closest analogy for the Nerdkit are the Functions used for writing data to the
UART, the LCD, or the Delay Function. (While not truly an API, it is close.)

In Windows...

There is a plethora of API Functions that are available.

So the answer to your question is "Yes, it is possible to do what you want in C".

But...

It may not be, as you contend, "C Language would be best for me"...

Programming stricly in "C for Windows" is quite tedious. (Which in large part is why
C++ was born...)

Of course there are many "Frameworks" that can be employed to make it less
tedious, but it really is alot more learning than you have already done in C.
(A Programming Framework is a bit like a "High Level API"... It just does/takes
care of alot of the tedious housekeeping stuff that you would have to take care
of by yourself.)

I would DEFINATELY recommend Python as Ralph already has.
(I used to Programmer's Notepad to write my Python Code, but mostly I use Geany now...)

I use JAVA alot as well, but Python is much more capable of running programs unchanged
in different OS's than JAVA is. (At least for most of what I do... I run in
Windows and Ubuntu mostly and several distributions for the Raspberry Pi too.)

Python is INCREDIBLY FAST and there are a multitude of 3rd Party Libraries too.

DEFINATLEY stick with Python 3.x.
DO NOT BOTHER with Python 2.x since that is going away, and there are a few differences
in coding.

November 24, 2014
by jmuthe
jmuthe's Avatar

Okay thank you for the advice. I just downloaded the python 3.4.2 and so far find that it is actually easier to work with then other programming languages. I am working with the basics now and will eventually try to learn graphics.

Post a Reply

Please log in to post a reply.

Did you know that NerdKits has been featured in the MIT Undergraduate Research Journal? Learn more...