Request for Assistance in Accurately Calculating PWM Pulse Width in Flowcode v10

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
bilal
Posts: 20
Joined: Sat Dec 06, 2014 5:15 pm
Has thanked: 1 time

Request for Assistance in Accurately Calculating PWM Pulse Width in Flowcode v10

Post by bilal »

Hello everyone,

I hope you are all doing well. I need your help in solving a technical challenge I am currently facing in my project. I am working on reading the pulse width coming from a PWM signal and displaying it accurately on the serial monitor using Flowcode software. However, I have been unable to achieve high accuracy because the timer division gives 62500 Hz per second, and this is the highest frequency available on the Arduino Uno board.

I would like to share the problem with you in the hope that it will stimulate your ideas and contribute to finding a solution. Unfortunately, I cannot provide an attached file for the Flowcode project, but I will share a simple code that I want to formulate on Flowcode.

Code: Select all

// Reading the pulse width and displaying it on the serial monitor

void setup() {
  Serial.begin(9600);
}

void loop() {
  unsigned long pulseWidth = pulseIn(PWM_PIN, HIGH); // Reading the pulse width
  Serial.print("Width of PWM pulse: ");
  Serial.print(pulseWidth);
  Serial.println(" microseconds");
  delay(1000);
}


I hope this is sufficient for understanding the problem. If you are able to improve the code or provide a solution, I would be grateful for your contribution.

Thank you very much for your continuous cooperation and support.

Best regards,
bilal

Post Reply