#include <stdio.h>
#include <math.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#define PI 3.14159265
#define A 100 // Amplitude
#define FREQ 20 // Frequency in Hz
#define STEP 0.05 // Time step in seconds
#define SAMPLES (int)(1.0 / STEP) // Number of samples (1 sec duration)
void app_main(void)
{
while(1)
{
float sine_wave[SAMPLES];
printf("Index,Time(s),Value\n");
for (int i = 0; i < SAMPLES; i++) {
float t = i * STEP;
float value = A * sin(2 * PI * FREQ * t);
sine_wave[i] = value;
// Print to UART so you can copy to Excel
printf("%d,%.2f,%.2f\n", i, t, value);
}
// Stop the task after printing (no infinite loop)
vTaskDelay(pdMS_TO_TICKS(1000));
}
}