you could feed the signal to a digital pin to detect edges and to an analogue pin to read voltage level
on a rising edge read the ADC? e.g.
#define PB0 16
volatile int pwm_value = 0;
volatile int prev_time = 0;
volatile float voltage=0.0;
void setup() {
Serial.begin(115200);
analogReadResolution(12);
// when pin D2 goes high, call the rising function
attachInterrupt(PB0, rising, RISING);
}
void loop() {
if (pwm_value > 0) {
Serial.println(pwm_value);
Serial.printf("voltage %f\n", voltage);
delay(1000);
}
}
void rising() {
attachInterrupt(PB0, falling, FALLING);
prev_time = micros();
voltage= analogRead(34) * 3.3/4096; // read the input pin
}
void falling() {
attachInterrupt(PB0, rising, RISING);
pwm_value = micros() - prev_time;
//Serial.println(pwm_value);
}
the serial monitor displays
voltage 2.457275
50002
voltage 2.506421
50002
voltage 2.501587
50002
voltage 2.501587
the oscilloscope says the voltage is 2.7volts the signal generator says it is 2.6volts