Week 14
Interface and Application
Assignment Files
To be able to do the interface we have to load a program to the arduino, this program must be able to receive and send instructions through the serial monitor, that means we have to consider the speed of the connection. For this assignment consider 9600 bauds, and the Serial library of Arduino "Serial.write", and "serial.read" with a conditional structure that allows to visualize the changes in the electronic components.
To generate the interface use two programs, Processing and Unity3D. The most important thing to be able to visualize the data is to connect to the serial port, this is achieved through the Serial processing library and the C # Serial library in Unity.
To send and receive data from arduino it is necessary to program it for serial communication, in the following image it is shown as:
![Image](week14im/w14-01.png)
If we use processing we must download the library that allows you to quickly create "ControlP5" interfaces, review the images
![Image](week14im/w14-04.png)
![Image](week14im/w14-02-02.png)
![Image](week14im/w14-02-01.png)
In Processing.org there is a library that enable to use GUI resources.
![Image](week14im/w14-05.png)
In Unity it is necessary to create a Script that contains the Serial connection, previously we have to enter the option of Api Compatibility Level 2.0
![Image](week14im/w14-07-0.png)
![Image](week14im/w14-07-1.png)
![Image](week14im/w14-07.png)
The main problem to solve is the serial communication, it is necessary to indicate what will be the connection speed of arduino, and in function to that configure the processing library. You have to prepare Unity-C # Api to be able to communicate by COM port