Pulse wave

float uz_wavegen_pulse(float amplitude, float frequency_Hz, float duty_cycle)

Returns one sample of a pulse wave.

Parameters
  • amplitude – Amplitude for the pulse wave

  • frequency_Hz – Frequency for the pulse wave in Hz. Only positive values are permitted

  • duty_cycle – Duty Cycle for the pulse wave. Only values 0.0 <= DutyCycle <= 1.0 are permitted

Returns

Returns one sample for current system time

Example

Listing 75 Example function call to pulse wave generator
1#include "uz_wavegen.h"
2int main(void) {
3   float amplitude = 8.0f;
4   float frequency_Hz = 10.0f;
5   float duty_cycle = 0.5f;
6   float output = uz_wavegen_pulse(amplitude, frequency_Hz, duty_cycle);
7}

Description

This function calculates a pulse wave with specified offset based on the global system time.

Figure made with TikZ

Fig. 56 pulse wave