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 » C++

July 01, 2011
by hariharan
hariharan's Avatar

After a long time, I am posting questions. But, important ones.

  1. Can I program the MCU with C++?
  2. If so, can i mix C++ and C while Programming?
  3. Is there GUI for C?
July 02, 2011
by Ralphxyz
Ralphxyz's Avatar

Hi hariharan,

1. C++ is considered overkill for AVR programming but you can use it. You will mostly end up using C syntax even though you call it C++.

2. Yes

3. Depends on your platform and what exactly you consider a GUI.
For Windows there is Programmers NotePad and even AVR Studio
For Mac there is Xcode.

For all the OSs there is enhanced Text Editors that will at least do Syntax coloring.

If you do not want syntax coloring or any "smarts" you can use any text editor of course that would not be a GUI.

Ralph

July 02, 2011
by hariharan
hariharan's Avatar

I mean, can i make graphic applications with C? And can I make computer applications with C and C++?

July 02, 2011
by Ralphxyz
Ralphxyz's Avatar

Yes, there probable are more/better graphic libraries in C++.

You need to read up on the GNU GCC compiler. Then read up on the AVR-gcc compiler.

The AVR mcu will be limited by the lack of memory and of course display devices.

If you want a GUI for your PC Python has a interesting graphics library.

What are you wanting to do and on what platform?

Ralph

July 04, 2011
by hariharan
hariharan's Avatar

Like, I want to learn to program and make applications for mcu and computer as a hobby. I am deciding what programming language I can use for both.

July 05, 2011
by Ralphxyz
Ralphxyz's Avatar

Well I would recommend you start with C for the mcu and Python for you PC. Get those under your belt and then you can expand

rapidly. For PC GUI programming traditionally it has been C++ for a Windows pc for programming a ipad or other Apple device

There is Objective C and Objective C++ this is done using Xcode on a Mac.

The thing is get a foundation, learning C first will be easily extended to other languages.

Ralph

July 07, 2011
by Hexorg
Hexorg's Avatar

Ralph, well actually most windows' GUI can be created with C code, and even pure asm. You don't need any of the classes' abilities of C++ for that, just a few pointers, and arrays (structures).

But in general, pure C is better for MCU programming. C++ - for PC, and python is just awesome for everything :D (and easy)

July 13, 2011
by BobaMosfet
BobaMosfet's Avatar

There is nothing that cannot be done with C and assembler. Why just this morning, I had a union of bacon and eggs over a structure of toast. I was able to use pointers to find a plate for it, and then a ran a subroutine to process it into my own interface.

:P

BM

Post a Reply

Please log in to post a reply.

Did you know that a microcontroller can measure an RC time constant? Learn more...