Close

Micros() implemented

A project log for Barnabas Blocks Upgrade - BIG 2021

Webserial API webtool to upload Arduino code.

richardrichard 07/28/2021 at 21:486 Comments

7/28/21

Hi guys, I'm heading to norcal to visit some friends so I had to work pretty quickly. I was able to create a constant oval block to output Micros(). I don't have an arduino handy so I haven't been able to check it, but it seems to compile okay. Regarding the actual block, I just used one of the pre-existing oval shapes to save time lol, although, I DID have to manually input it into blocks_compressed.js. Regarding the logic, as micros() already exists, that part wasn't that difficult. No actual logic programming, just linking things together. micros links to micros(), so, yeah, wasn't too difficult. 

Manipulating the C output in arduino_compressed.js can allow for some pretty nifty utilizations for micros() or millis() for that matter to do other things as well, but the way I designed it is simply to begin the timer to go until it hits a certain microsecond, then perform the "do" task. 

I wish I can test this out on an actual arduino, but probably have to wait until next Tuesday.

Anyway, please let me know if  I did something wrong, or if I deviated from the assignment. I BELIEVE you can use a function within an if statement in C, if I'm wrong, then darn lol, it's going to require some re-working. Would love to know thoughts!

I will take the rest of the week to see the how/why/what of the compression method. 

Discussions

Edward Li wrote 07/29/2021 at 03:46 point

Nice, Dante!  Did you try the method of creating a js file for the block as well?

  Are you sure? yes | no

richard wrote 07/29/2021 at 18:59 point

Ah, that's right. I should've done that, I'll do it shortly! (I'm assuming you mean me, though, lol)

  Are you sure? yes | no

Edward Li wrote 07/30/2021 at 11:20 point

Ah yes, you haha

  Are you sure? yes | no

Sion Hwang wrote 07/28/2021 at 23:46 point

So fast! wow haha

  Are you sure? yes | no

richard wrote 07/29/2021 at 00:13 point

haha I want to enjoy my weekend :). let me konw if you found a better way to implement millis(), millis() and micros() is like... nearly identical in a lot of ways haha.

  Are you sure? yes | no

richard wrote 07/28/2021 at 22:01 point

On that note, actually, as Dante saw some discrepancies from arduino_compressed.js and what he compressed himself. I'm inclined to think Mr. Andrew gulp'ed it and then changed things in arduion_compressed.js to further fine-tune. Will look more into this!

  Are you sure? yes | no