Вы находитесь на странице: 1из 18

Xevro User’s manual installation guide 2018

User’s Manual guide


Arduino simulator 1.5 MacOS

Made by Marc Van Den Berge and Louis D’Hont (Xevro)

Warning: The computer must by connect to a Arduino UNO.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Introduction
The Arduino UNO Simulator is made for quick tests and small projects. there is still
further developed in order to obtain the widest possible I/O functions. The Arduino
Simulator is designed to test a program quickly with the Arduino UNO without real-
ly having connections to external I/O (buttons, potentiometers, display, 7 segment
display, ...).

To be use the simulator we need 3 programs:

• - Java JDK
• - The Arduino simulation program
• - The Arduino software

In order to use the Simulator we need to download the Java JDK on our MacBook or
iMac, you can find the download link on the website of Xevro. Or go to this link and
download the MacOS version:
www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html

Arduino software
For we start using the Arduino Simulator we need the Arduino software, it is also free
available on the Arduino website: http://arduino.cc/en/Main/Software

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Installation guide
1. Before you can use the Arduino Simulator you will need to install the Java JDK.
On Windows computers it’s enough to install the basic Java JRE.
The Java JDK isn’t automatically installed and the simulator will not run without
the Java JDK.
www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html

2. Xevro is an unauthorized company so your Mac will give a message to give us


permissions. In order to do that you will go to ‘System Preferences’ and go to
the ’Security & Privacy’. Click on the tab ‘General’ and press on the ‘Open Anyway’
button, and the Arduino Simulator will start.

3. The first time when you start the Arduino Simulator you will get a window pop-
up that asks to give your password. This is to change the permissions of the Ja-
va/extensions folder where the Serial driver needs to come. It will close automati-
cally after type in your password. This will just happen ones.

4. Drag the Arduino Simulator 1.5 MacOS in the Programs folder.

5. Copy the license key in the Arduino Simulator of the website page.

If you bump into a mistake or problem, please send me an e-mail to


info@xevro.be

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

License activation
The Arduino Simulator is free available to use. The first time you open the
Simulator there will be an activation pops up where you can activate the Simulator.

Click on the ‘Change Product Key’ to insert the license key you copied on the
website. To vivificate the license key you click on the ‘Activate’ button.

License key input field

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

How to use it
The Arduino Simulator is very easy to understand. The simulator needs 5 simple
things in order to work correctly.

1. Connect the Arduino board


2. Upload your custom Arduino code with the corresponding library file
3. Change the original Arduino code
4. Select the used in-outputs in the Arduino Simulator
5. Connect the Arduino Simulator to the Arduino board with the right serial
port

1. Connect the Arduino Board


The Arduino Simulator works with a lot of Arduino boards:
• Arduino UNO
• Arduino Mega
• Arduino Nano
• Arduino Micro
• Arduino Leonardo
• Arduino ...

Only the digital and analog pins that are available on the Simulator can be used!
Disconnect the Arduino Simulator before uploading the Arduino code.

2. Upload your custom Arduino code with the corresponding library file
Open the simulator and go to 'Help -> Arduino UNO programming code -> Arduino
UNO programming code (Ino)’.
This will open a Arduino (ino) file with the corresponding library and important
code in it.

3. Change the original Arduino code


In order to let the Simulator understand the code, we have devised our own in-
structions. To maintain the usability, we have decided to change the current in-
structions a little bit and replace only the first letter with a capital letter. We have
modified the instructions with a point so that the point may be omitted.

digitalWrite(13, HIGH); -> DigitalWrite(13, HIGH);

lcd.print("x"); -> lcdprint("x");

4. Select the used in-outputs in the Arduino Simulator


Each input and output on the Simulator has a selection box where the used digital
or analog pin can be connected.

5. Connect the Arduino Simulator to the Arduino board with the right serial port
The Arduino Simulator knows which port is the Arduino board.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Make sure the Arduino is disconnect while uploading the Arduino code.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Code Changes
The Arduino program works with instructions that the I/O read and write, we must
convert this to serial communication, now we need to write new instructions for
this.
We don’t want to change the real instructions so we decided to make the first
character as a capital. And the instructions with a point in it are changed with no
point.
Example:
digitalWrite(12, HIGH);
become DigitalWrite(12, HIGH);

The first letter is now a case of removing the tip:

Instructions Arduino Instructions Arduino Simulator


digitalWrite(x,y); = DigitalWrite(x,y); attention: capital letter

digitalRead(x); = DigitalRead(x); attention: capital letter

analogWrite(x,y); = AnalogWrite(x,y); attention: capital letter

analogRead(x); = AnalogRead(x); attention: capital letter

myservo.write(x); = myservowrite(x); attention: the ‘.’ remove

Serial.print(x); = Serialprint(x); attention: the ‘.’ remove

tone(x,y ,z); = Tone(x,y ,z); attention: capital letter

noTone (x); = NoTone(x); attention: capital letter

lcd.setCursor(x,y); = lcdsetCursor(x,y); attention: the ‘.’ remove

lcd.print(long x); = lcdprint(x); attention: the ‘.’ remove

lcd.print(“x”); = lcdprint(“x”); attention: the ‘.’ remove

lcd.autoscroll(); = lcdautoscroll(); attention: the ‘.’ remove

lcd.noAutoscroll(); = lcdnoAutoscroll(); attention: the ‘.’ remove

lcd.clear(); = lcdclear(); attention: the ‘.’ remove

lcd.display(); = lcddisplay(); attention: the ‘.’ remove

lcd.noDisplay(); = lcdnoDisplay(); attention: the ‘.’ remove

lcd.blink(); = lcdblink(); attention: the ‘.’ remove

lcd.noBlink(); = lcdnoBlink(); attention: the ‘.’ remove

lcd.write(x); = lcdwrite(x); attention: the ‘.’ remove

lcd.rightToLeft(); = lcdrightToLeft(); attention: the ‘.’ remove

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

lcd.leftToRight(); = lcdleftToRight(); attention: the ‘.’ remove

lcd.home(); = lcdhome(); attention: the ‘.’ remove

lcd.cursor(); = lcdcursor(); attention: the ‘.’ remove

lcd.scrollDisplayLeft(); = lcdscrollDisplayLeft(); attention: the ‘.’ remove

lcd.scrollDisplayRight(); = lcdscrollDisplayRight(); attention: the ‘.’ Remove

For starters just open an example and edit these.


What to do:

1. Open a ‘ino’ file from the Arduino Simulator: go to Help -> Arduino UNO
programming code -> Arduino UNO programming code (Ino).
2. Change your code with the right instructions (the list of instructions are on
the next page)
3. Upload your code, done!

attention:
Remember to adjust the 'Void Setup to initialize the real I/O!!

Example: pinMode (0, OUTPUT);


pinMode (1, INPUT);
To understand better performance are elaborated numerous examples.
In each sketch are the instructions changed, so you only need to connect the inputs
and outputs through the screen and the sketch should work.

With Save you can store the settings for later:

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Preparing the Arduino UNO program


Open a new sketch (Help -> Arduino UNO programming code -> Arduino UNO pro-
gramming code (Ino)
The Simulator UNO-program (.ino) and the Simulator library “SimulatorProgram.h”
can found under Help:

Start the “Arduino UNO programming code” application


Now you can set your own code into the Arduino, if its upload in the Arduino you
can test it with the Simulator.

Attention: The library “SimulatorProgram.h” stand by the Simulator.

Uploading of a new program to the Arduino UNO

• Start the Arduino application


• Open the sketch
• Arduino UNO connecting with the Mac:

• Select board “Arduino UNO”


• Select the serial port
• Upload the program into the Arduino UNO

Attention: The BaudRate on the simulator is 9600.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Configure the serial port


Set the BaudRate
The BaudRate is set by default at 9600 or chance the BaudRate in the Arduino code
and also in the Simulator.

Set the Com port


First you need to select the serial port, the USB port that is used by the Arduino.
The Simulator auto detects the Arduino and turns ‘red’.

Before the selection After the selection

Attention:

- At start-up, we also see the state of the simulator at the bottom of the serial port:

- Once you have selected the correct serial port changes to this text:

You will get a error message when you want to connect with a pin that is already
used.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Use the digital I/O


Digital Inputs
- The Arduino UNO has 14 digital I/O pins we can configure this pins into inputs or
outputs I/O.
- This pins get symbolic images as D0 to D13 and the text change red if its select.

- We have 8 buttons, this buttons can set to one of the


inputs D0… D13, After the selection change the color
green.

Buttons
- When you keep pressing it send a ‘1’ to the Arduino
- No pressing send an ‘0’ to the Arduino
- With this button:

- There are text boxes to set a little information.

Leds
- We have 14 leds, each led coupled to one output D0… D13.
- After each selected led turns the combobox green.
- There is a text box for comments.
- If you click on the led you change the color of the led. Available colors:
Red, Green, Blue and Yellow. It’s also possible to use a relay as output.

Buzzer

- The buzzer can select to a digital output of D0… D13.


- When we send a signal on the output pin we get 1
second sound.
- The pitch can be changed with using the slider. (0 -
10KHz)
- There is a text box for comments.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

7 segment Display

- The display will be automatically connecting to the outputs D0


- D6 (D7 = DP not used)
- Depending on the type of display can be choose ‘common
Anode’ or ‘common cathode’.

Use the Analog I/O


Sliders
- There are currently 3 present sliders that can be separately coupled to each of the
six analog inputs A0…A5 (value of 0 <-> 1023)
- The analog value can be read on the simulator.
- There is a text box for comments.
- The combobox change into yellow after
selection.

Sound detector
- The sound detector may be coupled to one of the 6 analog inputs A0…A5 (value of 0
<-> 1023), The combobox change into yellow after selection.
- This detector records no sound just responding to a noise level adjustable with the
slider.
- Once the recording is started it will be nothing more to serve on the screen
because it is continuously listened to the microphone.
- When the noise level is exceeded, the progress bar will show the noise level in
percent.
- Once detection has addressed this value is (value of 0 <-> 1023) sent to the Arduino,
which can also be read on the simulator.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

The analog Outputs


Slider/Bar

- There are 2 analogue outputs which first met slider and one filled progress bar
- Both of these outputs can be coupled separately to one of each analog output 6
PWM 3, 5, 6, 9, 10 and 11 (value of 0 <-> 1023)
- The combobox change into pink after selection.
- There is a text box for comments.
- The analog output can be read on the simulator.

Sound generator
- The sound generator can be coupled to one of the 6 analog outputs PWM 3, 5, 6, 9,
10 and 11
(value of 0 <-> 1023)
- The combobox change into pink after selection.
- There is a text box for comments.
- The analog output of the Arduino can be read on the simulator.

Servo
- The servo is automatically connecting to the output D12 after pressing on the
button.
- There is a text box for comments.
- On the big screen we can see the analog output value (servo mode) from the
Arduino UNO.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

LCD display

- The display connects automatically to the outputs D4-


7 and D11, D12
- The display has 2 rows and functions almost like the
real display.

Attention:
The difference with the real display is the bottom row starts from right to left, this
one should keep in mind during programming. It’s also not possible to separately
control the pixels.

Tone Melody
- The Tone Melody will automatically connection to the output D8.
- Through the Arduino UNO can send a note to the MAC which one can read the
frequency and duration. You can use this for
example in order to create a mini piano by means
of the 8 input buttons.

Squarewave generator
- The squarewave generator can connect to one of the 6 inputs A0 – A5, this in-
puts (A0 – A5) need to declared in a digital input. The Analog pins can be used
as Digital pins, they got the configuration: A0 = D14, A1 = D15, …
- The squarewave generator can make a squarewave with a frequency of 0,1 to
10Hz.

- Attention: The instruction for the squarewave generator is DigitalRead().

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

A few things while preparing the Arduino program


Always upload the sketch to the Arduino UNO.
if the simulator is connected with the Arduino you can’t upload the Arduino pro-
gram. We made a tool 'Disconnect' which closes the connection with the serial port
of the simulator so that you can upload the sketch to the Arduino.

The great advantage of this is that we don’t need to shut down the Simulator
whenever we want to upload the sketch simulator.

After downloading the simulator, we connect again with the serial port and we ini-
tialize the I/O.

Disconnect serial port Choose serial port

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Save and Restore of settings


With “Save” you can save your selected I/O and dictated texts.
the “Restore” button restores the settings to make it easy to use.
We can save the filename of the extension with *.sav or *.txt.
You find the ‘Save and Restore’ function under “File”.

Save Restore

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Screen resolution
We have 6 options:

- 13 inch MacBook pro size


- Resolution: 1024 x 768
- Resolution: 1336 x 768
- Resolution: 1920 x 1080
- Full Screen (iMac)
- Variable resolution (min: 500, max: 2000)

Languages
You can choose the languages: Dutch or English.

Arduino Simulator 1.5 MacOS


Xevro User’s manual installation guide 2018

Working serial message


Everything goes through serial communication (USB) between the Arduino UNO and the
Mac.

The BaudRate and serial port of the Arduino UNO and the simulator should be identical, if
not they can’t connect to each other.
To send and receive data we need to make a type of protocol/structure so that the Mac
and Arduino UNO understand each other. The following protocols are bin used in the
Simulator.

Examples Structure serial message between the Arduino UNO and the Arduino
Simulator (java)

2. Receive digital input 1. (I00…13) Send Analog output Servo.


Forehead: I00 Forehead: S12
Data: "0000" or "1111" Data: 0 - 1023
End of message: LF End of message: LF

3. Send digital output 1. (O00…13) Send Analog PWM output 1. (P03…5,6,9,10,11)


Forehead: O00 Forehead: P03
Data: "0000" of "1111" Data: 0 - 1023
End of message: LF End of message: LF

4. Receive Analog input 1. (A00…5)


Forehead: A00
Data: 0 - 1023
End of message: LF

5. Sending Frequency Tone. (TF8)


Forehead: TF8
Data: 0 - 99999 (Hz)
End of message: LF

6. Sending Tone duration. (TT8)


Forehead: TT8
Data: 0 - 99999 (ms)
End of message: LF

7. Sending text. (txt) LCD 2 rows


Forehead: txt
Data: 0 - 31 (char)
End of message: LF

8. Sending text. (tx1) LCD top row


Forehead: tx1
Data: 0 -15 (char)
End of message: LF

9. Sending text. (tx2) LCD lower row


Forehead: tx2
Data: 0 - 15 (char)
End of message: LF

Arduino Simulator 1.5 MacOS

Вам также может понравиться