Sign in:

Knob unable to receive sensor value consistently

Home Forums Cubelets Blockly Forum Knob unable to receive sensor value consistently

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #10249
    Josh Pollock

    I’m having a weird problem with reprogramming my knob cubelet, using blockly.

    Here’s how I have my cubelets connected

    Bluetooth -> Distance -> Battery -> Knob -> Bar Graph

    First, I tried reprogramming the knob with a simple program like this, in the forever block:

    set block_value to sensor_value

    This does exactly what I expect. Namely, it makes the knob behave normally: when I turn it, the bar graph goes from 0 to 10 as expected.

    Then I tried reprogramming the knob with a more complicated program, also in the forever block:

    if weighted_average > 32
    wait 40 x sensor_value milliseconds
    set block_value to 255

    I would have expected this to read the weighted average of neighboring blocks (in this case the distance cubelet) and enter the if block when the value exceeds 32. That part works.

    But then I would have expected it to wait “40 x the knob position” milliseconds, then set the block value to max (255). The knob sensor value should go from 0 to 255. So that’s is 0 to 10,200 millisecons, or approximately 10 seconds. After the wait, it should set the block position to 255, which will show up as the bar chart going to max.

    But what seems to be happening is the knob’s sensor value is always 255. So I put my hand over the distance cubelet, and 10 seconds later the bar chart goes to max. Always 10 seconds, regardless of what I turn the knob to. Even with the knob at the minimum value, the wait is always about 10 seconds.

    I’ve tried other experiments to confirm I’m getting 255 back from the knob every time (for example, I tried blinking the bar chart “sensor_value divided by 10” times – it always blinks 25 times).

    Any idea what’s going on?


    Jonathan Moyes

    Hi Josh,

    Thanks for your post – I’m sure we can figure this out! There are a few places this problem could be coming from, so recreating the problem here in the lab is the first step.

    Are you using Cubelets Blockly on a mobile device, or desktop? If you’re on the desktop version: Could you send me your Blockly program? A .cubelet file is created when you save a Cubelets Blockly program, that’s what we’ll need to help. You can upload it here: and then paste the resulting link in a post here for us to retrieve. Or feel free to email it to me:

    If you are using the mobile version of Cubelets Blockly, a screenshot of your program will work too.

    Best regards,

    Jon Moyes
    Modular Robotics

    Josh Pollock

    Thanks for the quick response. I sent you an email with two example programs attached. Please let me know what you think.

    Josh Pollock

    Any suggestions?

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Cubelets Blockly Forum’ is closed to new topics and replies.