Output C variable to mblock


#1

Hi, im working on an extension for arduino uno and reading an sensor values
my problem is that i want to my C variable shows in mblock
for example how can i set my C values to a number block in my extension ?


#2

Could you please be more clear about what you want?

Thanks for your time,
Best_codes


#3

yes. for example i want to make an extension that get X Y Z from the mpu6050 gyroscope sensor and show its numbers on the screen of mblock.
i created some blocks for sensor setup but in the next i want to my X Y and Z variables in my C code output to the mblock.
how can i do this?


#4

There is probably already an extension to do this, but if there isn’t, then I will give you directions.

Check this box while you are on the block settings tab and under the block you want to make have a checkbox:
Screenshot%20from%202022-07-11%2008-33-24
(Note: You may have to scroll down over the different blockk settings until you find the check box)

Now the box should look like this:
Screenshot%20from%202022-07-11%2008-34-26
Click save:
Screenshot%20from%202022-07-11%2008-35-02
Now preview your extension by going to the extension preview page or clicking the “preview” button.

This will create a checkbox next to your block.

If I wasn’t clear enough, or for more information on how to make your block actually return accurate information, please mention me as @Best_codes.

Thanks for your time,
Best_codes


#5

@Best_codes thanks for your tips but my problem wasnt it.
i turn on the (( This block comes with a checkbox for reading value )) but the number was showed was not my C variable .
i have a varable in my Arduino/C code that i want to write it in this block that showing on the stage or screen
my problem is : How to write an Arduino/C variable to extension Block

thanks for your attention ( sorry for my bad English )
sina


#6

@sina سلام مشکلت را بگو تا حل کنم


#7

No worries, write to me in your original language and I’ll figure it out. :smiley:


#8

@Best_codes Hello, i read this topic but still not undestand how to show some data. I have block that read data from sensor< so i want to show it in live mode or upload mode, how can i do this? Thanks


#9

@ImFox1st you can’t show the value in Upload Mode. You can in Live Mode, but the implementation is a bit tricky.
I haven’t done any extension building in a while, so I can do this. If you find an extension that does what you are looking to do in the same programming language, tell me. I will see if I can send you the source for the extension so you can see how it’s done.


#10

@Best_codes i found 1 solution, but it works only if your device based on official motherdoard like arduino Mega