Skip to content

Signals

Overview

The Signals section of the cee API provides functions for driving, measuring, and managing electrical signal pins (voltage, current, resistance, frequency, and phase) in CC: Computer Energetics.


Calling Conventions / Prefixes

All methods within the Signals section are accessed through the global cee namespace:

local volts = cee.getSignalVoltage(1)
cee.setSignalVoltage(1, 50)

API Reference Table

Method Signature Arguments & Types Description
cee.getSignalVoltage(pin) pin (number) Returns volts on the pin.
cee.setSignalVoltage(pin, v) pin (number), v (number) Drive the pin, 0-100V, 20A max.
cee.getSignalCurrent(pin) pin (number) Returns amps through the pin.
cee.setSignalCurrent(pin, a) pin (number), a (number) Drive it as a current source.
cee.getSignalResistance(pin) pin (number) Returns ohms looking out of the pin.
cee.getSignalRMS(pin) pin (number) Returns RMS volts over the last second.
cee.getSignalFrequency(pin) pin (number) Returns Hz, 0 if not oscillating.
cee.getSignalPhase(pin) pin (number) Returns degrees against the sample clock.
cee.getPhaseAngle(a, b) a (number), b (number) Returns degrees between two pins.
cee.isDriving(pin) pin (number) Returns whether we are driving this pin.
cee.clearSignal(pin) pin (number) Stops driving the pin.

Lua Code Examples

Example 1: Measuring Voltage and Current

local pin = 1
local volts = cee.getSignalVoltage(pin)
local amps = cee.getSignalCurrent(pin)

print("Pin " .. pin .. " -> " .. volts .. "V, " .. amps .. "A")

Example 2: Driving a Signal Pin

local pin = 2
-- Drive pin 2 at 50 volts
cee.setSignalVoltage(pin, 50)

-- Check if we are driving it
if cee.isDriving(pin) then
    print("Pin is being driven.")
end

-- Stop driving later
cee.clearSignal(pin)