Skip to main content

Gyroscope

caution

This service is rc and may change in the future.

A 3-axis gyroscope.

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()

Registers

reading

Indicates the current rates acting on gyroscope.

  • type: Register<any[]> (packing format i12.20 i12.20 i12.20)

  • track incoming values

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
gyroscope.reading.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingError

Error on the reading value.

  • type: Register<number> (packing format u12.20)

  • optional: this register may not be implemented

  • read only

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
const value = await gyroscope.readingError.read()
  • track incoming values
import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
gyroscope.readingError.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

readingRange

Configures the range of rotation rates. The value will be "rounded up" to one of max_rates_supported.

  • type: Register<number> (packing format u12.20)

  • optional: this register may not be implemented

  • read and write

import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
const value = await gyroscope.readingRange.read()
await gyroscope.readingRange.write(value)
  • track incoming values
import { Gyroscope } from "@devicescript/core"

const gyroscope = new Gyroscope()
// ...
gyroscope.readingRange.subscribe(async (value) => {
...
})
note

write and read will block until a server is bound to the client.

supportedRanges

Lists values supported for writing max_rate.

  • type: Register<any[]> (packing format r: u12.20)
  • optional: this register may not be implemented
  • constant: the register value will not change (until the next reset)
note

write and read will block until a server is bound to the client.