Arduino mode, two question


#1

Hi,

I Have two question.

Q1, I make a variable “v”, and set v = 13 to connect LED.
Then I let LED to HIGH or LOW,

=> at Arduino mode,

void setup(){
pinMode(v,OUTPUT);
v = 13; <-- the code should be execute before pinMode(v,OUTPUT).
}

Q2, “Logic And” and “Logic or” are wrong!?
=> at Arduino mode,
For Logic And, shuold be “&&” not "&"
For Logic Or, shuold be “||” not “|”

Thank you!


#2
  1. This is a known issue, will be fixed in the upcoming release 3.4.3.
  2. This is a century old problem. Yes, you are right - it should use logical expressions. But it actually works with bit operations. If you have a program that doesn’t work, please tell me.

Since mBlock has so many users around the globe, I’m not sure whether there are some places using this as a trick, and it could be designed on purpose since there are developers that left the development team I can’t get touch with. An adjustment like this may trigger many errors in the program.


#3

I’d love to hear that the mblock team will be fix. About the logic opertations, I think many students and users will use the mblock to learn the program.

We should show them the normal case. So, I very hope the mblock team could correct the logic expressions.

Thank you very much.


#4

Dear bigeyex,

Today, the mBlock 3.4.3 beta1 version releases to download.
I immediately installed it.
It is sad that the problems still exist.
Could the mblock team fix the two problem?
They are the troubling problems.

BR.


#5

Hi,

Could the mblock team fix two problem?

Thank.


#6

We are working on those.


#7

The mBlock 3.4.3 beta 6 has fixed those.
Thank you and the mBlock team very much.


#8

Dear bigeyex,

I got the other problem or question.

B1,
About pinMode(), It’s better that the pinMode() maybe appears after the variable settings Immediately. Because some case will lost to execute, for example, my test case.

B2,
I get undefined block for logic expressions when I Open project.

B3,
After v3.4.2, the Arduino IDE of the mblock seems to appear the “portable” folder. It will cause I can’t set the sketchbook folder. I try the Arduino IDE(v1.6.13) and it is ok. But the Arduino IDE(v.1.6.5) has this problem, It seems the Arduino IDE’s bug. I do not know whether the mblock will be updated the Arduino IDE version.


#9
  1. it’s not simple to predict when and how you use your variable. But it’s possible to place those before any “for” or “while” commands - maybe that’s a good solution.

  2. please attach the project file you wish to open so the devs could inspect it - that’s why it takes so long to fix a problem that appears simple.

  3. not possible to update Arduino IDE - it triggers many other bugs.


#10

Dear bigeyex,

1, Your method seems better.

2, This my test project. I new the project (logic And/OR and set digit pin) and save it. When I opened this project, I got the undefined block for logic expressions. I tried several times, the results are the same.
TestBlock.sb2 (73.1 KB)

3, OK, I see.

B.R.


Arduino - emulating Shiftout (74HS595) - in mblock?
#11

Now in 2020, the problem of the pinmodes being set before the variable that they reference still exists in Mblock 5.2.0


#12

Hi MurrayElliot,
Thanks for your feedback.
I have submitted the problem to our product manager and will inform you once I got news.