703
edits
mNo edit summary |
|||
Line 35: | Line 35: | ||
=== using variables === | === using variables === | ||
variables are a place to store numbers in the memory. They make life | variables are a place to store numbers in the memory of a computer. They make life for us now: | ||
replace pin number by a variable - changing pin is much less tedious and cumbersome. | replace pin number by a variable - changing the pin is much less tedious and cumbersome. | ||
replacing the delay by a variable - only change it once. | |||
Changing variables during runtime (while the program is running) is also possible: | Changing variables during runtime (while the program is running) is also possible: | ||
'''Most simple example of changing a variable:''' | |||
<source lang="c"> | |||
myVariable = 100; | |||
delay(myVariable); | |||
myVariable = 1000; | |||
delay(myVariable); | |||
</source> | |||
'''Having some random fun''' | '''Having some random fun''' | ||
Line 62: | Line 71: | ||
<source lang="c"> delaytime = 200 </source> | <source lang="c"> delaytime = 200 </source> | ||
Now the value of delaytime is 200. | Now the value of delaytime is 200. | ||
=== a new kind of output: ''analogWrite'' === | === a new kind of output: ''analogWrite'' === |
edits