15. Interface and application programming.

Assignment

  • Individual assignment:

    • Write an application that interfaces a user with an input &/or output device that you made
  • Group assignment:

    • Compare as many tool options as possible

Video of this Week Assignment

Video01 – Jokenpo Hand

Project Idea

In this activity, it was decided to use Processing again to make the application of user interaction with the output device that is the robotic hand built in Machine design and Mechanical Design week. The idea is that the hand performs the positions of the JOKENPO, a Japanese hand game!!

Image1 - jokenpo

  • For the construction of this project, it was necessary to program the interface in Processing and the programming in Arduino.

Processing Programming

The serial library, controlP5, PFont and PImage were imported to configure the serial, buttons, button source and images. The configurations using the controlP5 and serial libraries have already been presented in the Output devices, so they will not be addressed again. I very good tutorial about processing can be found in The Coding Train Youtube channel.

Image2 - Setup and draw

  • In the draw function, the position of the game name, font size and color are configured.

Image3 - Class button

  • The Button class was created, which creates buttons with your text and sets its position, size of the button and the font using with its size and font, that is why the PFont library was imported. The Button class is called in the setup to start the buttons.

Image4 - Class Images

  • The Class Images loads images. The images files must be in the same folder as the program. There is the need to preset functions parameter in order to succed loading images. It also needs to match variable and file names.

Image5 - Data sending class

  • Functions were created that are activated with the click of the buttons, they are created from the names of the buttons and are responsible for sending the values via the serial that are read by the Arduino and will carry out the corresponding positions.

The bottons images was download in the pinclipart site in this link.

Arduino Programming

In Arduino, the library is imported to configure ESP32 servos and servo objects are created. This was done before in Embedded Programming week In setup, the pins of the servos are configured with their gates, speeds and they are configured to leave the hand open.

Image6 -setup function

The loop function is responsible for checking if there is any value in the serial and if it has, its value will be read and saved in the variable serialValor and depending on the value, the position of the stone, paper, scissors or random will occur.

Image7 - Loop function

The Random function, different from the other position functions, will close and open the hand three times within three seconds and depending on the value saved in the valorRandom variable, one of the three movements of the jokenpo will occur.

Image8 - random function

Outlined problems

In carrying out this activity there was a problem in the movement of some fingers. The fingers were stuck due to mechanical problems. The pulleys that were printed were very worn and the hand was unable to close nor open correctly. I fix the problem manually. There was also a problem with the thumb. The pins to which it was connected were not working and consequently it couldn’t be triggered. Because this mechanical problems was very hard to set the parameters in the code to make the correct moviments.

Conclusion

This week was possible to to deepen the knowledgein using processing. Specifically, the knowledge in creating a screen and importing images that I believe will be useful in the final project.

  • All the programming files of this week assignment can be find in the repository

Files