• Hi!
    I have some problems.

    var ir_adc = [0, 0, 0, 0, 0];
    
    var ir_adc_loop = setInterval(function() {
      i2c.writeTo(0x0A, [1, 10]); i2c.writeTo(0x0A, [14]); var ir_i2c = i2c.readFrom(0x0A, 10);
      ir_adc = [((ir_i2c[0] * 256) + ir_i2c[1]),
            ((ir_i2c[2] * 256) + ir_i2c [3]), 
            ((ir_i2c[4] * 256) + ir_i2c [5]), 
            ((ir_i2c[6] * 256) + ir_i2c [7]), 
            ((ir_i2c[8] * 256) + ir_i2c [9])];
    }, 10);
    

    Here is my code for Espruino web ide. ( To get IR Sensor value)
    So if I upload this code to robot,

    >ir_adc
    =[38,44,43,41,41]
    

    I can get my ir_adc value.
    But I want to get ir_adc value in my blockly_something.js.
    Is there a solution to get IN-ROBOT value at my vscode SUPERCOOL?

    Thank you.

  • I think it's enough just to define a variable called ir_adc in Blockly (assuming you already have your code uploaded to the MDBT42Q). Either that or pull in the "A JavaScript "+"Expression" and just type in ir_adc

    However it sounds like you want to make a block for it in the IDE code itself? If so it's as easy as just making the block return the next ir_adc - for instance you could just use this: https://github.com/espruino/EspruinoWebI­DE/blob/gh-pages/blockly/blockly_ble.js#­L376-L385

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

How can I get a variable from espruino web ide in blockly code?(MDBT42Q)

Posted by Avatar for user110706 @user110706

Actions