Need help from Chuck


#1

This is the only way I know of to reach Chuck McK. Chuck how else can I reach you concerning your mBot book. I am on Play an Octave and not getting anywhere, see attachments. Is there another way to contact you about this? This isn’t probably what the forum is made for.

On the bigger attachment you will see the program as the book tells me to do it, I think I did everything correctly but it doesn’t work at all. I only use one hat block at a time, depending on which one I’m trying to load to the mBot. The blocks in the blue rectangle run perfectly. I am using mblock v3.4.11 on a Mac.

The smaller attachment shows what I get when unloading the blocks in the red rectangle when the hat block is attached to only those blocks.

If there is a more direct way to contact you about book questions please let me know.

Thanks, Mark H.


#2

Hi Mark,

You can always contact me for support at support@senestone.com. :slight_smile:

Let’s examine your code more closely.

The Play [Note] function is the issue. What has occurred is that you have called the block being defined within itself which leads to recursion (i.e., the block calling itself). if you replace the call to Play [Note] with the play tone on note [Note] beat [Quarter], it should work as expected.

Don’t feel too bad because this is a common error that I’ve seen made by many of the students I’ve taught. :smiley:

The general notion of blocks is to encapsulate a set of functionality that gets reused rather than repeating the code every time it needs to get called. While it is certainly possible to call other blocks within a block, calling the block itself will result in unexpected behaviors (although recursion is certainly a useful technique in some instances).

Hope this helps!

Chuck

P.S. I also try to write to a blog (https://senestone.com/blog) as I have time about various things related to Arduino, robotics, etc. I don’t have a lot of time, but I try to share information whenever I do. :slight_smile:


#3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.