Closed FernandoGarcia closed 1 year ago
Hi!
This is my simple and dirty proposal to make this code compatible with Pulseview.
Using your code with OSL client I have results like this:
And using Pulseview I have this:
As you can see the Pulseview graph is inverted. It also was discussed here.
Using my modified version I have graphs like this:
Looking the graph and the values that I can get using this code the result looks right.
#if defined(ESP8266) void ICACHE_RAM_ATTR falling(); void ICACHE_RAM_ATTR rising(); #define PIN D8 // PIN where the PWM singal arrives #else #define PIN 2 // PIN where the PWM singal arrives #endif // global variables volatile unsigned int pulse_width = 0; volatile unsigned int prev_time = 0; void rising() { attachInterrupt(digitalPinToInterrupt(PIN), &falling, FALLING); // when PIN goes LOW, call falling() prev_time = micros(); } void falling() { attachInterrupt(digitalPinToInterrupt(PIN), &rising, RISING); // when PIN goes HIGH, call rising() pulse_width = micros() - prev_time; Serial.println(pulse_width); } void setup() { pinMode(PIN, INPUT_PULLUP); Serial.begin(115200); attachInterrupt(digitalPinToInterrupt(PIN), &rising, RISING); // when PIN goes HIGH, call rising() sei(); // enable interrupts } void loop() { }
I have some doubt about what to do to revert the values of the function triggerMicro() I would like to get your help to improve it.
triggerMicro()
I know the right way to make it could be detecting the SUMP client and sending the values as needed but I have no idea how to do.
I hope you find it useful.
Best regards.
Hi!
This is my simple and dirty proposal to make this code compatible with Pulseview.
Using your code with OSL client I have results like this:
And using Pulseview I have this:
As you can see the Pulseview graph is inverted. It also was discussed here.
Using my modified version I have graphs like this:
Looking the graph and the values that I can get using this code the result looks right.
I have some doubt about what to do to revert the values of the function
triggerMicro()
I would like to get your help to improve it.I know the right way to make it could be detecting the SUMP client and sending the values as needed but I have no idea how to do.
I hope you find it useful.
Best regards.