Progress Update

Radios challenge

Today I kept working on the radio function, I am trying to make the radio more interesting. I’m expecting that I can add different action to each button of the controller micro bit. It only works when I trying to add codes for button A and B. However, the picture below shows the problem. The picture below is the code for the micro bit that being controlled, it only allows me to use one “on radio received ‘string'” block, so if I already made a code block to the action when pressing the B button, I can not add another code block (either “on radio received ‘received number'” or “on radio received ‘string'”)  in the same file for button A. 

input.onButtonPressed(Button.A, function () {
    radio.sendString(" move")
})
input.onButtonPressed(Button.B, function () {
    radio.sendString("shapeline")
})
basic.forever(function () {
    radio.setGroup(1)
})

From the Javascript code, I figure out why the other two code block cannot be added.  Since the function has a fixed name which is radio. onReceivedString (function (string)) which is not able to use twice in the same code file. Otherwise, normally the function which is at the bottom of any other code is going to replace those code before. Only the bottom code is going to work.

radio.onReceivedString(function (pinkF) {
    for (let i = 0; i < 18; i++) {
        lights.smileCycleRainbowTime(100, 3000)
        gigglebot.driveMillisec(gigglebotWhichDriveDirection.Forward, 500)
        gigglebot.turnMillisec(gigglebotWhichTurnDirection.Right, 1500)
    }
})
basic.forever(function () {
    radio.setGroup(1)
})

So, I tried to add two file to the micro bit at the same time. But it was not working really well, the micro bit always eject itself once after one.hex code file been added to it. 

I think it might be some limitation that micro bit has.

Sharp turn – spin

I only used turn before as the function to change the direction of my Artbot, but I realized that it will only give me a curve turn. Even the very first time when I tried to make the polygon, I set the turning time to a very small number in order to make the turn smaller and make the turning corn a little bit less curly, but that method didn’t work really well. So I carefully read the basic concept of how the gigglebot works. Then I figure out that gigglebot turning happens around a wheel, it is much useful for two gigglebot avoiding each other.

However, spinning is around the center of the gigglebot where we put pen instead of around the wheel, so this is much useful when we want to create shape turn or corner.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.