You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no block to negate number in Makecode. There is a block to negate logic value (not).
I miss a block to negate value of number. When number is constant, it is not problem, just negative number can be entered but when number is stored in variable, then entering negative value is "tricky". Block 0 - variable or -1 * variable can be used but this makes code just more complex. Could be a block -1 * number or negative number) added to Makecode? There is a block to have math operations on single parameter like round, floor, etc or square root, sin, etc, could be negate operation added to one of these blocks?
EXAMPLE
I want to control continuous servo with micro:bit. Servo can be controlled with value from -100 to 100, to define speed in percentage. I have custom function servo with one parameter, speed. It is speed in percentage and it is used to calculate duration of the control pulse. Note that when I want serve to run in opposite direction (with value -speed) I has to use 0 - speed block, not straight forward solution...
There is no block to negate number in Makecode. There is a block to negate logic value (
not
).I miss a block to negate value of number. When number is constant, it is not problem, just negative number can be entered but when number is stored in variable, then entering negative value is "tricky". Block
0 - variable
or-1 * variable
can be used but this makes code just more complex. Could be a block-1 * number
ornegative number
) added to Makecode? There is a block to have math operations on single parameter likeround
,floor
, etc orsquare root
,sin
, etc, could benegate
operation added to one of these blocks?EXAMPLE
I want to control continuous servo with
micro:bit
. Servo can be controlled with value from -100 to 100, to define speed in percentage. I have custom functionservo
with one parameter, speed. It is speed in percentage and it is used to calculate duration of the control pulse. Note that when I want serve to run in opposite direction (with value -speed) I has to use0 - speed
block, not straight forward solution...CODE
DEMO in Makecode
The text was updated successfully, but these errors were encountered: