Triangle wave

float uz_wavegen_triangle(float amplitude, float frequency_Hz)

Returns one sample of a triangle wave.

Parameters
  • amplitude – Amplitude for the triangle wave

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

Returns

Returns one sample for current system time

Example

Listing 81 Example function call to triangle wave generator
1#include "uz_wavegen.h"
2int main(void) {
3   float amplitude = 6.0f;
4   float frequency_Hz = 5.0f;
5   float output = uz_wavegen_triangle(amplitude, frequency_Hz);
6}

Description

This function calculates a triangle wave based on the global system time.

Figure made with TikZ

Fig. 63 triangle wave