Using an Integer array to hold brightness data

variables

#1

1) Give a description of the problem
I made an integer list/array, but I am unable to reference the values I need

2) What is the expected behaviour?
The expression always returns 0, but I would like the brightness from the array

3) What is happening/not happening?
Apparently, I don’t understand arrays.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full


#2

Arrays containing numbers are usually written like this:


Maybe something like this:

(Set level confirmed to work as intended)


#3

Thank you! :grinning:

No concise way to initialize the array like in the comment?

Oh, and why the phantom set variable statement at the end of the piston? It editable, but stays gray and doesn’t seem to do anything if modified.


#4

The phantom code was used during testing… I disabled that block, but did not delete it.
(not visible in the jpeg above)


As far as condensing code… I often use math (without arrays) to achieve this… I decide on a low, a high, and then another low… as well as what times are what… My mathematical algorithm can dynamically determine what temp at which time.


#5

OK. Gotcha. So can you initialize the array in the declaration, or no?

I’m working on an algorithm that could work for me. The numbers I plugged in are close to what I want, but a little random. Math would allow and even smoother “curve”.


#6

Super cool… TIL that you can disable code blocks under Edit / advanced options!


#7

You can also select a block (left click to the right of the text) and then disable in the top right.

temp


It turns the block grey, and that code will not be executed.
(although it does take up space towards the max piston size)


#8

Amazing how things like that can escape notice.