Square
Modulation
to transform sound pressure to a square wave.
Specify the frequency as an integer in the constructor.
use autd3::prelude::*;
#[allow(unused_variables)]
fn main() {
let m = Square::new(150 * Hz);
}
#include<autd3.hpp>
int main() {
autd3::Square m(150 * autd3::Hz);
return 0; }
using AUTD3Sharp.Modulation;
using static AUTD3Sharp.Units;
var m = new Square(150.0f * Hz);
from pyautd3 import Hz, Square
m = Square(150 * Hz)
Set amplitude
You can set the amplitude of the square wave with with_low
and with_high
for low level and high level, respectively.
use autd3::prelude::*;
#[allow(unused_variables)]
fn main() {
let m = Square::new(150 * Hz)
.with_low(0x00)
.with_high(0xFF);
}
#include<autd3.hpp>
int main() {
const auto m = autd3::Square(150 * autd3::Hz).with_low(0x00).with_high(0xFF);
return 0; }
using AUTD3Sharp;
using AUTD3Sharp.Modulation;
using static AUTD3Sharp.Units;
var m = new Square(150u * Hz)
.WithLow(0x00)
.WithHigh(0xFF);
from pyautd3 import Hz, Square
m = Square(150 * Hz).with_low(0x00).with_high(0xFF)
Set duty ratio
You can set the duty ratio of the square wave with with_duty
.
use autd3::prelude::*;
#[allow(unused_variables)]
fn main() {
let m = Square::new(150 * Hz).with_duty(0.5);
}
#include<autd3.hpp>
int main() {
const auto m = autd3::Square(150 * autd3::Hz).with_duty(0.5);
return 0; }
using AUTD3Sharp.Modulation;
using static AUTD3Sharp.Units;
var m = new Square(150u * Hz).WithDuty(0.5f);
from pyautd3 import Hz, Square
m = Square(150 * Hz).with_duty(0.5)