Close

Project Log Entry 3 - Shawn

A project log for Barnabas Blocks Upgrade - BIG 2021

Webserial API webtool to upload Arduino code.

sion-hwangSion Hwang 08/03/2021 at 10:183 Comments

For my function (millis), I decided to state the value under the "Constants" tab because I thought that the function, which returns a set unsigned long value, was sort of a constant that the user could not change. This value can be inserted in a conditional statement to test for whether it should run or not, like so:

This is what the editors tab looked like with my millis function:

For the block itself, I followed Richard's steps of putting all of the necessary code inside the millis.js file. I initially tried to put the millis block in the blocks/customs/arduino.js file, but had struggles with making the files link and work. Thus, putting it altogether made the linking easier.
I noticed that for the current state of Barnabas blocks, some blocks were put in the arduino.js file in the blocks/custom directory, while others were declared in the blocks_compressed.js file in the generators. Still others were declared in both files, which threw me off a little bit. So, I just created the millis.js file above and placed it in the generators file, then invoked it in index.html.
I also placed the block itself in the constants tab:
Hence, this is what I had for the assignment so far. It was definitely a bit of a challenge, figuring out where to put all this information. The 'deconstructed' method of manually putting every part of the block in the compressed files proved difficult; it made more sense for me to make separate files for different block types and invoke them in the index.html file. Perhaps the overall project could be a lot more organized and easily understandable for users if we were to structure it this way. Again, I'm still new to html and js, so there may be things I do not fully comprehend about the functionality of having these multiple files.

Discussions

richard wrote 08/03/2021 at 17:36 point

awesome! :)

  Are you sure? yes | no

Edward Li wrote 08/03/2021 at 15:15 point

Nice Sion!  Good work!

  Are you sure? yes | no

Sion Hwang wrote 08/03/2021 at 10:18 point

Forgot to post a couple hours ago!!

  Are you sure? yes | no