import { Redpitaya } from "https://deno.land/x/pita_api@0.9.1/mod.ts";
The Redpitaya class provides a way to exchange messages with a Redpitaya device and control its digital and analog inputs and outputs. Redpitaya class is a proxy for Redpitaya low level API.
Examples
Example 1
Example 1
const redpitaya = await Project.init(config)
await redpitaya.channel.dac1.writeSlice([0, 0, 0, 256, 256, 256, 0, 0, 0])
console.log('Gate signal on DAC 1')
await redpitaya.pin.digital.led1.write(true)
console.log('Led 1 is ON')
Methods
addEventListener(type: "connect" | "disconnect" | "error", listener: (event: Event) => void | Promise<void>)
Adds an event listener for connect, disconnect, or error events.
close(cause?: string)
Close the Redpitaya connection and triggers disconnect event.
Check if underlaying websocket is opened
connection<T extends "signals" | "parameters", K extends Exclude<MessageId, ConfigId>>(type: T, key: K)
Exchange messages with Redpitaya. Send and recieve signals and parameters from Redpitaya backend.