How to return value to block


#1

I want to make a block that will read a sensor but need to know how to get my Arduno code to return the value to the block
Capture


#2

Hi OutoftheBOTS,
You can read the value of the sensor by sprites.
image
image
Thanks.


#3

I am making my own custom block using extension builder. I wanted to know how to get my ardunio code that I was wrapping up to return a value back the mbock. I have worked it out now thanks.


#4

Hello @OutoftheBOTS,
You can do something like this
In setup window put all the stuff to set up your sensor
In the code window read the sensor without a “;”
For example, if you are checking your sensor connection pin with the name “pin” you can do:
(without the space betwen " * " and the world “pin”. I put the space because the editor)
setup:
mySensorConfigure(/* pin */);

code:
mySensorRead(/* pin */)

I hope it helps
Rodrigo


#5

Hello, please can you advise how you have done this