Debian Codegraph @

examples/book/digital-artists/chapter11/Listing11.5.ck

raw
1 // Listing 11.5 Receive lines of strings from an Arduino via a SerialIO object
2
3 SerialIO cereal; // (1) Declares a Serial Input/Output object
4 cereal.open(0, SerialIO.B9600, SerialIO.ASCII); // (2) Opens it with specific parameters
5
6 while(true)
7 {
8 cereal.onLine() => now; // (3) Sleeps until Serial object has something
9 cereal.getLine() => string line; // (4) Gets a line of text from it
10 chout <= "line: " <= line; // (5) Prints that out
11 }
12
13