StickOS
DI-159 PLC Hardware Manual
Variable Assignments
Simple variables are assigned with the following statement:
let
variable
=
expression
If the variable represents an output "pin variable", the corresponding DI-159 PLC output pin is
immediately updated.
Similarly, array variable elements are assigned with the following statement:
let
variable
[
expression
] =
expression
Where the first expression evaluates to an array index between 0 and the length of the array
minus one, and the second expression is assigned to the specified array element.
String variables are assigned with the following statement:
let
variable
$
=
string
Multiple variables may be assigned in a single statement by separating them with commas:
let
var1
=
expr1
,
var2
=
expr2
, ...
Examples
>
10 dim simple, array[4]
>
20 while simple<4 do
>
30 let array[simple] = simple*simple
>
40 let simple = 1
>
50 endwhile
>
60 for simple = 0 to 3
>
70 print array[simple]
>
80 next
>
run
0
1
4
9
>
new
>
10 dim a$[20]
>
20 let a$="hello"+" "+"world!"
>
30 print a$
>
run
hello world!
41
Summary of Contents for DI-159
Page 51: ...StickOS DI 159 PLC Hardware Manual 4 is even _ 51...
Page 76: ...DI 159 Block Diagram 76...
Page 77: ...Dimensional Drawing 77...