Getting started arduino uno R3 & queries

I have recently purchased a uno R3 board. Earlier I have worked on other 8/32 bit micro's. I have few queries:

  1. I was looking at example Blink. Can I check inside library function like pinMode,digitalWrite etc, i.e what's happening isnide this funtions.

  2. Usually in other IDE I have multiple .c 7 .h files. But how to do it here. Everytime I click new, IDE opens new sketch & I cannot specify whether I need .c or .h files.

  3. Where I define crystal freq

  1. Yes. The code for the library functions is buried in the Arduino IDE folders. I'm not home so I can't say exactly where, but there aren't that many C source files to dig through.

  2. Typically you don't need those in Arduino, though I think you can manually write them and put them in the folder if you do. Arduino is meant to be easy and simple to get started with - it sounds like you're used to programming something harder than Arduino.

  3. To tell the Arduino IDE what speed the crystal is, just select the correct board; The IDE includes board definitions for all the official arduino boards with the correct clock speeds. For boards with non-normal clock settings, you'd need a new board definition.

@DrAzzy,

  1. i found some codes in installation dir. Inst dir:\Arduino\libraries

But it don't have basic function like pinMode, Analog read, map etc.

I want to know how they are doing it.

  1. I am starter in arduino. But I have seen many times codes have huge number of lines/function modules. So its easy to keep different modules in diff .c & .files. That's why I had asked. I will look on internet. I am sure someone msut have done it. :)

  2. Thanks. Will check how to add new board definitions after I go throgh basic things.

The core source code is in arduino/hardware/arduino/cores/arduino directory (on 1.0.6; slightly different on 1.5.x)

The IDE does some pre-processing of your “sketch” that includes adding some .h file includes; you have additional ones to add if you use a non-core library, notable “Arduino.h” from the above core directory, which in turn includes additional files:

#include <stdlib.h>
#include <string.h>
#include <math.h>

#include <avr/pgmspace.h>
#include <avr/io.h>
#include <avr/interrupt.h>

#include "binary.h"

And as part of the build procedure, the IDE behaves “sorta like “make””, and builds/includes a bunch of the core libraries (and user libraries if you use them.)

You might be comfortable turning on the “verbose” option for compilation in the arduino preferences; then you can see a good part of the stuff that goes on “behind the scenes.”