examples\serial\ints.ck
SerialIO.list() @=> string list[];

for(int i; i < list.size(); i++)
{
    chout <= i <= ": " <= list[i] <= IO.newline();
}

0 => int device;
if(me.args()) me.arg(0) => Std.atoi => device;

SerialIO cereal;
cereal.open(device, SerialIO.B9600, SerialIO.ASCII);

while(true)
{
    cereal.onInts(2) => now;
    cereal.getInts() @=> int ints[];
    chout <= "ints: ";
    for(int i; i < ints.size(); i++)
    {
        chout <= ints[i] <= " ";
    }

    chout <= IO.newline();
}
home .. language .. program .. examples