Data Scribers
Overview
A Data Scriber is a strip-chart recorder device in CC: Computer Energetics: one pen that moves across the paper, and paper that only ever goes one way. It functions as an analog charting tool that plots samples, writes labels, and advances via time or data drives.
Calling Conventions / Prefixes
Data Scriber handles are obtained via cee.getDataScriber(pin, n) or cee.getDataScribers(pin), and methods are called directly on the returned scriber handle:
local scri = cee.getDataScriber(1)
scri.penDown()
API Reference Table
| Method Signature | Arguments & Types | Description |
|---|---|---|
scriber.isLidOpen() |
None | Returns whether the lid is up. |
scriber.hasPaper() |
None | Returns whether a sheet is loaded. |
scriber.hasPower() |
None | Returns whether the gate is up (>= 110V), right way round. |
scriber.getStylus() |
None | Returns where the pen is, 0-1. |
scriber.setStylus(x) |
x (number) |
Moves the pen without ink. |
scriber.penDown() |
None | Starts drawing. |
scriber.penUp() |
None | Stops drawing. |
scriber.isPenDown() |
None | Returns whether the pen is on the paper. |
scriber.plot(value) |
value (number) |
Plots a sample: moves, inks, and steps the paper. |
scriber.plotPoint(value) |
value (number) |
The same call, reads better in a loop. |
scriber.moveTo(x) |
x (number) |
Slides the pen there with no ink. |
scriber.lineTo(x, columns) |
x (number), columns (number, optional) |
Draws a straight line to x over a run of columns. |
scriber.setInkSize(n) |
n (number, 1 to 3) |
Sets nib width. |
scriber.getInkSize() |
None | Returns how thick the pen is drawing. |
scriber.setDrive(mode, gear) |
mode (string), gear (number, 1-4) |
Sets drive mode ('time' or 'data') and gear. |
scriber.setDriveRate(perSecond) |
perSecond (number) |
Sets paper speed as a plain number. |
scriber.getDriveRate() |
None | Returns columns a second right now. |
scriber.getDrive() |
None | Returns what is driving the paper. |
scriber.write(text, across) |
text (string), across (boolean, optional) |
Label at the pen; across turns it. |
scriber.writeAcross(text) |
text (string) |
The same, upright, max 8 letters. |
scriber.setInkColour(colour) |
colour (number) |
Changes pen color (e.g. colours.red). |
scriber.getInkColour() |
None | Returns the current pen color. |
scriber.clear() |
None | Wipes the chart, keeping the sheet. |
scriber.getStatus() |
None | Returns all scriber states in one table. |
Lua Code Examples
Example 1: Basic Strip-Chart Plotting
local s = cee.getDataScriber(1)
if s then
s.setDrive('time', 2)
s.penDown()
while true do
s.plot(math.random())
sleep(0.1)
end
end