Squarewave

SQUAREWAVE is the software square wave generation interface with duty cycle variation control.

Add Output Device

Item

Description

Squarewave

Functions for generating a square wave.

set(frequency,duty,time): Sets the output squarewave with a default duty cycle of 50% (if duty is not specified) and an output frequency specified by "frequence". The frequency may be from 1 to 500 Hz. The duty cycle, if specified, may be from 0 to 100%.
off(): Turns the squarewave off.

CE products: from squarewv import *

TI-Nspire CX II: from ti_hub import *

 

 

The function to create the object is pasted from the menu.

var=squarewave("port")

Command:

var=squarewave("port")

Command
Syntax:

var=squarewave("port")

Python
Code
Sample:

TI Nspire CX II:

from ti_hub import *

 

sq1=squarewave("BB 7")

 

# Generate squarewave of

# 200Hz at 25% duty cycle

# for 5 seconds

sq1.set(200,25,5)

 

CE products:

from squarewv import *

 

sq1=squarewave("BB 7")

 

# Generate squarewave of

# 200Hz at 25% duty cycle

# for 5 seconds

sq1.set(200,25,5)

Range:

Describe:

Creates an object for a squarewave generator.

The port is limited to OUT 3 because a servo motor needs 5V to operate that is only available on OUT 3.

Result:

 

Type or
Addressable
Component:

Control

 

var.set(freq,duty,time)

Command:

var.set(freq,duty,time)

Command
Syntax:

var.set(freq,duty,time)

Range:

Describe:

Sets the output squarewave with a default duty cycle of 50% (if duty is not specified) and an output frequency specified by “freq”. “freq” may be from 1 to 500 Hz. duty cycle, if specified, may be from 0 to 100%.

Result:

Type or
Addressable
Component:

Control

 

var.off()

Command:

var.off()

Command
Syntax:

var.off()

Range:

Describe:

Turns off the squarewave being generated and sets output line on TI-Innovator hub to a digital low state.

Result:

Type or
Addressable
Component:

Control