Variables, e.g. "int" is an integer, a whole number that isn't divisible (i.e. hasn't got decimle places).
Variable save us lots of time, because we can replace a whole line of code for a simple tag.
For example:
if i write:
int val = 0 (<-- we are telling ardunio that when we write "val", we mean use the number 0)
at the top, then in the loop function write:
val = analogRead(analogPin); (<-- we are now telling arduino that when we write "val", instead of 0, we want it to output whatever number the analog pin is producing)
No comments:
Post a Comment