1

I'm a computer systems engineering student and was planning to buy an Arduino to learn embedded C programming. After researching I found mention that an Arduino may not be a good choice for a beginner that wants to learn about programming embedded systems using C.

I'm not sure if that is true, can an Arduino be programmed in C without using C++ and the other included class libraries? I'd prefer to learn how to program things at a fairly low level and not rely on libraries that hide details of the underlying hardware. Can the Arduino be used as a general AVR / microcontroller development platform to learn embedded C programming?

  • Well my programming and electronics skills are quite good (i'm third year student Computer system engineering) got good knowledge in computer architecture, but no experience in embedded systems.So i want to do projects which would teach me about them and how to code for them. – R3ack Sep 25 '14 at 5:15
  • The format of ee.se is more like a wiki than a forum. The aim is to develop a set of good, specific, questions, which can have fact or evidence based answers. So the usual approach is to update the question with extra information in response to comments. Unfortunately, your question still seems vague, and hence answers would be based on opinion, which is a poor fit to ee.se. Questions of the form, "I want to make an XYZ, my experience is ..., I plan to use an Arduino and an ABC, I have researched the web, found http... and http... however, I still need help with ..." is a better fit. – gbulmer Sep 25 '14 at 11:41
  • I had a bit of a problem following the title at first, but by "Type-C" do you mean something that can run C code for learning embedded systems? If so let me know and I might be able to edit the question into something more answerable. – PeterJ Sep 25 '14 at 12:40
  • yeah , it's for c language – R3ack Sep 25 '14 at 13:26
  • 4
    Yes, an Arduino can be programmed in ordinary C - use of the IDE and the quasi-C++ libraries is entirely optional, one is free to treat the hardware as an ATmega development board and use avr-gcc (or similar) directly, using either the arduino style (optiboot or whatever) bootloader or some other method (ISP, etc) to load the results into the chip. – Chris Stratton Sep 25 '14 at 15:50
3

The Arduino is a great place to start embedded C programming. You can use both C and CPP. There are tons of tutorials online and there are a bunch of books available. In addition there are lots of libraries available on GIT HUB for interfacing with all types of hardware like RF24 Wireless Transceivers.

If you want to go into more low level programming, you can. For example, you can set all Port B pins to Output:

// the setup routine runs once when you press reset:
void setup() {                

  // initialize the digital pins as an output.
  DDRB = 0xff;
}
2

[Not sure who's listening, as this is a 4 year old question posted by someone who no longer seems to have an account here, but... ]

... can an Arduino be programmed in C without using C++ and the other included class libraries?

You absolutely can use either C or C++, and make use of class libraries or write your own functions for either or both of computing tasks and managing your external hardware.

Can the Arduino be used as a general AVR / microcontroller development platform to learn embedded C programming?

Yes, for the reasons above, and more. Embedded systems differ from other computing systems by having deadlines the must meet. These can be soft deadlines (try to keep visible delays to a minimum so you don't annoy the user/operator) or hard deadlines (if you miss one, something could fail or someone might die). They come in different scales: my home thermostat could be capably run by an Attiny "with one pin tied behind its back". :) Other systems might contain many large-scale chips or a mix of both, networked internally to one another. A mid-scale example of this is an automobile engine controller. It runs your signals, entertainment system, ABS brakes and traction control, and more, all while opening and closing injector valves and firing spark plugs with precise timings, at up to 125 times per second. And that is for a pretty normal, family-car, "street" engine.

The Atmega328p (Uno's MCU) is sufficiently over-engineered to tolerate occasional misuse, being over-clocked or supplied a lower than spec'd voltage, has several ways to update/replace its program, is easy to hand-build into a custom micro-controller board, and after all that abuse, is cheap enough to replace if you do manage to damage one.

Documentation is readily available as are online communities like this one, to help with beginners questions, unusual questions, esoteric uses that maybe only a handful of people have tried or know about.

So, tl;dr: yes, I'd call it an ideal platform for everything you asked about.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy