Sie sind auf Seite 1von 26

Simulator for Arduino

1 / 26

Table of contents
Introduction .................................................................................................................................... 3 What's new ............................................................................................................................... 3 Free Version Differences ....................................................................................................... 3 Getting Started ............................................................................................................................. 5 System requirements .............................................................................................................. 5 Getting help .............................................................................................................................. 5 Using the IDE ................................................................................................................................ 6 Program Window .................................................................................................................... 6 Variables Area ........................................................................................................................ 7 Arduino Area ........................................................................................................................... 7 Bare Minimum .............................................................................................................................. 9 Loading a Sketch ....................................................................................................................... 10 Running a Sketch ....................................................................................................................... 11 Menu System .............................................................................................................................. 12 File Menu ............................................................................................................................... 12 Run Menu ............................................................................................................................... 12 View Menu ............................................................................................................................. 12 Options ................................................................................................................................... 13 Emulation ............................................................................................................................... 13 Hardware ............................................................................................................................... 14 Help ........................................................................................................................................ 14 Shortcut Toolbar ......................................................................................................................... 16 Emulation Toolbar ...................................................................................................................... 17 Shortcut keys .............................................................................................................................. 18 Program Window ....................................................................................................................... 19 Legend ................................................................................................................................... 19 BreakPoint ............................................................................................................................. 19 Edit Window ............................................................................................................................... 21 Analog Window .......................................................................................................................... 22 View Subroutines ....................................................................................................................... 23 Registry Settings ........................................................................................................................ 24 Version Info ................................................................................................................................. 25

2 / 26

Introduction
The benefits and features of an Arduino Simulator are: The ability to teach and demonstrate the inner workings of an Arduino sketch Test out a sketch without the hardware, or prior to purchasing hardware Debug a sketch Demonstrate a project to a potential customer Develop a complicated sketch faster than using the hardware The license for 10 users is designed for training groups where there is on instructor and 10 students.

What's new
The latest version allows all the Arduino Examples from Basics to Strings to be run successfully. Changes include: Add random and randomseed Fix Step Over on right bracket } Add Pause/Run or Stop button to stop a runaway program Add >>= and <<= operators Add Boolean, Float types Add do while loop and for loop with { on separate line Add library checks Add EEPROM, Ethernet functionality and maybe Servo Show include files in gray and fix upside down format Add #ifdef, #endif, #ifndef Add Serial1,2,3 and move Input data to inside panel Add full LCD functionality except for CGRAM constant definitions after loop() should now be evaluated Fix for loop issue inside while Ability to fold/unfold arrays in Variables area When breakpoint is hit, run only needs to be pressed once Add Show Volts

Free Version Differences


The Free Version is identical to the Pro Version, apart from the addition of a timer delay window. The Free version is supplied as a demo version to allow users to trial the Simulator for Arduino program. The logic and operation of the Simulator for Arduino program is identical apart from the timer delay. In addition to the Pro version, upgrades are offered for a minimum of 1 month.

3 / 26

4 / 26

Getting Started
Getting Started. Copy the zip file to a safe place and unzip the files into this separate directory. To run the program, double click the .exe file.

System requirements
The System Requirements are a PC Pentium II or later, running Windows XP or Windows 7.

Getting help
For help, please email arduinoshields@gmail.com

5 / 26

Using the IDE


The Simulator for Arduino IDE has several sections. These are: The Menu system which contains options and settings - refer to the Menu System for more info The Shortcut Toolbar provides single click action for commonly used operations The Emulation Toolbar which provides simulated data for the Serial port input, the Milliseconds and the SoftSerial input data The Program list box The Variables area The Arduino picture Note that the order of the Program window, Variables are and Arduino picture may be swapped by Selecting View|Arduino on Left. The preferred method is to have the Program Window on the left so that the work flow is input,data and output. When the Simulator for Arduino IDE is resized, the Variables window will disappear first since this is the least important window. If the main screen is made smaller, the Program window will then disappear and the Arduino Screen will always be on top. This allows for a program such as the bargraph.ino sketch (in the Display folder) to be simulated as it would appear in reality.

Program Window
The Program window area shows the program listing, and the cursor will always try to stay in the vertical center of the screen. The first line may be used to define the Arduino board type using the // Simulate UnoR3.jpg or // Simulate MegaR3.jpg commands. The Simulator for Arduino program will look for these commands inside the comments on the first line only. using commands inside comments allows the Arduino IDE to still compile the sketch without any changes. The UnoR3 and MegaR3 pictures are included in the Simulator for Arduino zip file.

6 / 26

Variables Area
The Variables area shows the status of all the variables used in program and their current value. The Value may be changed by clicking in the relevant cell and changing the value. The Qualifier column typically shows if the value is a const, unsigned, static or volatile type. The qualifier number in a heading row (shown by the gray shading) shows how many variables of that type have been defined.

When returning from a subroutine, the stack will be returned the the original state, and any variables defined in the subroutine or passed as arguments will be cleaned or removed. Right Click in the Variables area to bring up the Pop-up Menu. The Arrays can be folded by selecting the Fold Arrays item, and only the first element of each array will be shown.

Arduino Area

7 / 26

The The Arduino picture area allows for the digital inputs and outputs to be displayed along with the Analog input and output values. The digital pins have only been defined up to D21 currently.

8 / 26

Bare Minimum
Bare Minimum will load the bare minimum needed for a new sketch. Select Run|Edit Sketch and the press the rightmost button to load the Bare Minimum to start writing a sketch.

9 / 26

Loading a Sketch
To load a sketch, select File|Load Sketch, press the Load Sketch button or press F4. Navigate to the correct folder and select the *.ino file (or *.pde for previous Arduino versions).

10 / 26

Running a Sketch
After a sketch has been loaded, the first executable line of code will be highlighted. Now press the Step Inot button or the down arrow. Alternately, the F7 or F8 button may be pressed. The middle section of the screen displays the variables grid, and these are organised into Bytes, Chars, Int (eger)s, Long, Strings and Defines. Any value in the grid can be changed by selecting it and typing in a new number.

11 / 26

Menu System

The Menu system has seven sub-menus. These menus allow the Simulator to be customised.

File Menu
The File Menu Items are: Load Sketch (F4) - Load a Sketch into the program window Print Setup - open the Printer Setup Dialog Box Print - print a scaled picture of the program Open Sketch in Arduino - this opens the sketch in the Arduino IDE assuming Arduino is the default program to open sketches #include code - this inserts the contents of the #include file into the sketch which allows included subroutines to be run Exit - close the program

Run Menu
The Run Menu Items are: Reset - reset the program to the start or Setup routine Back - go back on step without executing any code Step Into - step one line through the program, and step into any subroutines Step Over - step one line and step over any subroutines Step Out of - Step out of a subroutine AutoStep - perform a step once every time period which is 100ms by default -see Shortcut toolbar Edit - open the Edit dialog box

View Menu
The View Menu Items are:

12 / 26

Analog - open or Close the Analog input window Emulation Tool bar - show the emulation tool bar which is useful for simulating Serial input data Subroutines - View the Subroutines and Line Numbers Arduino on Left - display the picture of the Arduino on the left and the Program window on the right Legend - display the digital pin legend on the top right of the Arduino picture

Options
The Options Menu Items are: Simulate Delay - Simulate delay of 1 second to 10 seconds with a Pop-up window Simulate Tone - Sound a tone when the tone() function is called Line Numbers - turn on the line numbers in the Program Window - this is useful for checking subroutines Ask on Line Change - if a new line is clicked in the program window, this option allows for a confirmation window before changing the line number Show Volts - this option allows for the analog number to be displayed as volts in the format x.xx (accurate to 0.01V)

Emulation
The Emulation Menu Items are: Serial - restore the Serial Output box (if undocked) SoftSerial - restore the SoftSerial Output box (if undocked) LCD - restore the LCD Output box (if undocked) Serial1 - restore the Serial1 Output box (if undocked) Serial2 - restore the Serial2 Output box (if undocked) Serial3 - restore the Serial3 Output box (if undocked) Ethernet - restore the Ethernet Output box (if undocked) All - Activate all the Emulation windows or turn them off Maximize Serial - make the Serial Emulation box larger to show long text lines

13 / 26

Please note: the SPI port uses the Serial3 port the Wire or I2C/TWI port uses the Serial2 port SoftSerial2 uses the Serial1 port

Hardware
The Hardware Menu Items are: Uno - display the Arduino picture as an Arduino Uno board Mega - display the Arduino picture as an Arduino Mega board Other - open up any picture file preferably 350 pixels wide to overlay on the Arduino picture

Help
Help Menu: About - Show the Program version Show Help - show this help - Note: this can also be activated by pressing F1

The Help | About screen shows the current software version as

14 / 26

or

The F of Free version is identical to the Pro Version but has a 30 second delay window any time a new sketch is loaded or edited. The Free version has been provided as demo version to allow the Simulator for Arduino program to be evaluated prior to purchase. It is recommended that after ten sketches have been tested, the Pro version be purchased since the cost of this delay is more than the purchase price. Also, it is helps speed up the design process.

15 / 26

Shortcut Toolbar
The Shortcut Toolbar provides single click actions for commonly used operations.

Button Functions: Load Sketch - loads a sketch from the last used folder into the Simulator Left up arrow - Reset Up Arrow - go back without executing any code Down Arrow - Step Over - single step jumping over any subroutines Left Down Arrow - Step out of subroutines excluding setup and loop Right Down Arrow - Single Step and Step into any subroutines Analog - show or close the Analog simulator window Run - AutoStep the program one instruction every xx ms The ms value can be edited. This time is the delay between line execution and is not the actual speed of the program since each line may take 1100ms to execute. If the AutoStep time period is set to faster than 10ms, the statusbar will not update to increase speed. Abort - abort if the program is stuck in any loop Decimal, Hex and Char - change the display view of the Variables

16 / 26

Emulation Toolbar
The Emulation Tool-bar allows for input data to be entered. The Emulation Tool-bar may be turned on or off by selecting View | Emulation Tool-bar. This value is saved on Exit.

For Serial ports, and Software Serial ports, the input date text boxes are now associated with the emulation boxes.The Serial data is read from left to right, so the left most character will be returned when using a Serial.read or Serial.peek command. Serial1 uses the Soft Serial data. The Milli seconds variable is displayed in a text box. This value can be adjusted by typing in a new value. Each line of program execution takes 1us or 0.001. The commands Delay and delayMicroseconds will add the accurate number of milliseconds or microseconds to the Millis Text box. PulseIn provides the return data for the pulseIn() command. This value must be a number.

17 / 26

Shortcut keys
Several keyboard shortcuts have been added. These are

F2 for Reset F3 for Go back without executing any code F4 for Load a sketch F5 to open the Analog Window F6 - Edit a sketch in the Edit Window F7 to Step Into F8 to Step Over Shift F8 to Step out of a subroutine F9 to Run or AutoStep

18 / 26

Program Window
The Program Window allows for the program to be stepped through. When selected, the F8 key may be used to step through the program. A new line may be selected by click anywhere in the program window. If the Ask on Line Change option is Checked, then a Dialog will ask for confirmation that the program should jump to the new Line.

The Statusbar shows the Line number, Last Line number and the next code to be executed. If the AutoStep time is set to less than 10ms, the Status-Bar will not update until AutoStep is stopped.

Legend

The Legend may be turned on by selecting View | Legend The Legend shows the colours and states of the Digital output. The AnalogWrite value of a digital pin will be displayed to the left of the digital pin when the analogWrite() routine is used.

BreakPoint
A breakpoint can be set by right clicking anywhere in the program window.

The pop-up menu has two options - to add or clear the breakpoint. If a BreakPoint is added, the breakpoint line will be shown in red. This is commonly used with the AutoStep or F9 command.

19 / 26

20 / 26

Edit Window
The Edit Sketch Window allows for sketches to be edited and updated or reloaded into the Program window Close - closes this window and resumes simulating the program Update Sketch - save this edited sketch back to the program window Save File As - save this sketch to a new .ino file Bare Minimum

21 / 26

Analog Window
The Analog Inputs Window allows for data to be simulated for the six analog inputs. The window may be resized to be smaller, and the scrollbars and text boxes will automatically resize to suit. The Analog Value may be changed by moving the scrollbar, or entering a new value in the white Edit box.

22 / 26

View Subroutines
The View Subroutines window allows for the Subroutines to be viewed along with the number of parameters and the line number. The line numbers may be viewed in the program window by selecting Options | Line Numbers

23 / 26

Registry Settings
Most settings are saved in the registry under the key SOFTWARE\Arduino Emulator 0.93 The Registry settings are shown below:

24 / 26

Version Info
v0.93 6th January 2012 Add random and randomseed Fix Step Over on right bracket } Add Pause/Run or Stop button to stop a runaway program Add >>= and <<= operators Add Boolean, Float types Add do while loop and for loop with { on separate line Add library checks Add EEPROM, Ethernet functionality and maybe Servo Show include files in gray and fix upside down format Add #ifdef, #endif, #ifndef Add Serial1,2,3 and move Input data to inside panel Add full LCD functionality except for CGRAM constant definitions after loop() should now be evaluated Fix for loop issue inside while

Ability to fold/unfold arrays in Variables area When breakpoint is hit, run only needs to be pressed once Add Show Volts

v0.92 - 30 December 2011 Add Open Sketch in Arduino function Allow #include to import code into main file The program line is always centered vertically where possible Add Step Over (F8) and Step Into (F7) in place of Step function Add a breakpoint by right clicking Re-organise Variables area into one list Remove checkboxes from digital pins Add Mega emulate mode Digital Input pins are now green All Arduino examples from Basics to Strings now work Variable values are now checked against the variable type and an error will issue if rollover occurs digitalWrite to an Input pin will now issue an error serialEvent interrupt now executes pulseIn implemented Boolean type implemented as a byte Some items to note are: Display | Rowscanning double arrays are not yet implemented - pixels becomes a 1D array v0.91 - 16 December 2011 Serial, Softserial and LCD output windows are now dockable and can be restored using View Added a Legend Digital output pins are red while digital input pins are yellow Improved the screen layout areas - program, variables and Uno screen Improve the display swap feature

25 / 26

Improved the line numbering in Status bar - next statement displayed not previous Added Print option dialog Fixed Subroutines checking and jumping Added 40 more keywords AnalogWrite now changes the shade or red on the digital pin Added String types and some special string operations Add a dialog when the program line is changed Function | Edit now has a Bare Minimum button Function | Edit Save now saves the filename as .ino if not specified

v0.80 - v0.90 1-Dec to 16-Dec-11 first test releases (Unidentified List Box error with v0.90)

26 / 26

Das könnte Ihnen auch gefallen