You can easily simulate your Arduino code using the famous Proteus ISIS.
You just will have to search for the specific Arduino simulation library for Proteus.
Here you a small tutorial of how to make this thing done:
First, identify the path the Arduino IDE generates the hex file to?
for example if you are using the official IDE you will find the hex file location in the "arduino IDE path/lib/preferences.txt"
Or if you are using Arduino ERW which I recommended the most on windows! So you can simply open the output folder by "Sketch > Copy HEX file as path".
Second, download the Arduino library from Here. Then copy ARDUINO.LIB
and ARDUINO.IDX
to folder "library" in the install directory Proteus.
Third, open ISIS and you should be able to find the component.
Please find this image of the worksheet after finishing the above steps, and simulation works just fine!
And as a head start for you, please find this small memo I prepared for the Arduino Uno Pins Layout:
0-14: I/O
A0-A5: Analog
We can use analog as digital:
=============================
Pinout:
00: Rx | Can't be used as I/O if I wrote in the code Serial.begin
01: TX |
02: Interrupt
03: Interrupt & PWM
04:
05: PWM
06: PWM
07:
08:
09: PWM
10: PWM & SPI
11: PWM & SPI
12: SPI
13: SPI
A0:
A1:
A2:
A3:
A4: TWI
A5: TWI