- Write an application that interfaces with an input and/or output device that you made, comparing as many tool options as possible.
Java Netbeans
For this assignment, I use the software java, use a variation is java NetBeans, this software to programing is not complicate, for this assignment you need to know
object-oriented programming, this language is a bit confusing but not difficult, and in this week, I programing to draw an analog value at real time bound with Arduino.
First, we are going to create a project where we will do the program and not create in the main class, because the frame is where make the program. For this program, you need some libraries one for the communication with the Arduino to the program recognize with you connect in the computer, the other library is for
read all the data to the Arduino send at the port serial and the program recollect all the values, the other library is to call at the graphic to draw all the data recollect,
these libraries you can find in the program already included or you can go in the next >link<
For the program first insert an image if you want, next add two buttons one to exit the program and other to run all the program, to begin the program first import all the
libraries to be able to occupy and if it is underlined the importation you can active clicking to have the error but not problem if you let them like >>THIS<< and >>HERE<<. For use the program first
you must change the port of the program recognize you can see this in device manager and a simple program in Arduino to read the analog value.
For the Arduino, not is difficult you in this example I connect a potentiometer at analog pin to receive the signal, and to the function the program be sure that the “COM”
be the correct and I tried with another circuit that transmits analog signal the program can read it but for the scale you might not see the graph.
In the next link I show you the process of the board that I made in the input week. >>PROCESS<<
In this video you can see the functioning of the program with a board make in the assignment input device, the program shows the change of the analog value of the sensor
when the magnet approaches the plate, the program graphs these values, and you can make the same process with a potentiometer.
In the next image you can see the graph of the program how show you.
In the other experiences I use the software MATLAB and android to send data of a sensors, for this you need an apk for your phone, this apk only make is send some data of the different sensor that the phone has in this case send the data of accelerometer and receive in MATLAB.
In the first part for the code use the “instrreset” to disconnect all instruments and the others to clean de window an delete all variables and close other programs.
In the second code create a port to connect the phone with the computer by WIFI connection you need create a port and know the direction IP for the phone.
In the third part make a graphic to move you can make any graphic but I recommend make a 3D axis, and create three vectors one to x, y and z. Use the command surf to show the graphic in 3D.
in the fourth receive the data and make some process first create a other file in csv for the data, then in a variable save the data as a text with the command fscanf, in the next part to divide the data use the command scandata and separate for commas and save in different positions of the vector, then extract three data of the vector principal, remember to extract the value use in this case “{}”, finally use the command rotate, this command function first with the call the graphic “h”, then select the axis that is going to move like [1 0 0] to the axis “x”, next the angle of moving in this case the data.
To the computer allow the transmission with the phone you can disactivate the firewall, antivirus and all similar because detected like a virus and block the connection if you have windows 10 is in all these windows.
Next configurate the direction IP for the program and for the apk to stablish the communicate and for send the data select in accelerometer this apk is made for Takashi Sasaki.
Learning outcomes:
Interpret and implement design and programming protocols to create a Graphic User Interface (GUI).
I use the programmer of java for make an interface to receive the analog value and graphic in a real time the variation of this value, the program complements with the software of
Arduino to receive the analog value and to be able to graph.
Have I:
- Described your process using words/images/screenshots
The process has screenshots and images of the functioning of the program and an explain how to use, this is described in all the process in the first objective.
- Explained the the GUI that you made and how you did it
It's a simple interface only need some buttons and windows, with help of a great tutorial have a message for a few errors.
- Outlined problems and how you fixed them
Some errors are for the name of the variables and in the moment to call to perform some function, another error is when you not call at libraries if you needed for the program function it
for this I leave a link with all the libraries that do you need for the program.