Week 20

1 minute read


  1. This week, I have tried to solve the error that gave about the permissions trying to open the serial port.
    • The problem was because as a security measure, requestPort must be initiated by a user gesture, for example pressing the button. And this user action has a limited time to open the serial port with webserialApi.
    • Then, as the integration was being implemented, when the “Execute mbot” button was pressed, the entire process was triggered. Consisting of:
      • First the code is sent to the server, to generate the binary. Generating the binary takes most of the time, and the longer the program the time is greater.
      • Second, once the binary is received, it is taken to the avrgirl library (which uses webserial) to upload it to the mbot.
    • Depending on the time it takes this entire process works or not, because the time limit of the user’s action is exceeded.
    • To solve the problem I tried:
      • Try to reduce the time in the functions used in the process, but it was not successful. Since the generation of the binary takes the longest and here the time cannot be reduced any more.
      • Having two buttons but one of them hidden, the user would have to press only one button, which below in the implementation, this would call the function that gets the binary. And so after “press the button”, as if it had been the user. But webserial detects that it was not a user action and fails.
    • Solution that I have carried out:
      • Having two buttons, one that is responsible for compilation and the other for loading the program. In this way, the program can be loaded without the problem of time due to user action. This measure does not have as much usability at the user level as having a button
      • To take advantage of the compile button, I have added functionality to display a message when a compilation error has occurred.
      • Video of the implementation