Page 1 of 1

the project works with arduino uno, but doesn't work with arduino nano neither arduino mega pro

Posted: Mon Dec 08, 2025 8:34 am
by islam88elshaer
I have an Interface panel using Gauge and textBox
using serial communication
My control board is arduino mega pro based
the Monitor doesn't receive any data from arduino mega pro USB cable, Therefore the Gauge and other controls doesn't respond
but by using exactly the same code on arduino Uno it works well, the monitor receives serial data and the Gauge responds.
Is there any additional configurations i should use with arduino mega pro ???

I attached my board photo and the progect photo
This is my code

Code: Select all

#include "MegunoLink.h" // Helpful functions for communicating with MegunoLink Pro. 
const int flowSensorPin = 3; // The pin the sensor is connected to
volatile int pulseCount = 0; // Counter for pulses
float flowRate = 0.0; // Calculated flow rate
unsigned long lastMillis = 0; // Time of last reading
const float calibrationFactor = 7.5; // Sensor specific calibration factor (pulses per liter)

void SendToIPGauge1(float vv)
{
InterfacePanel MyPanel;  
// Set control value
 MyPanel.SetNumber(F("IPGauge1"), vv);
}

void setup()
{
 Serial.begin(9600);
pinMode(flowSensorPin, INPUT_PULLUP); // Set the sensor pin as input with internal pull-up resistor
 attachInterrupt(digitalPinToInterrupt(flowSensorPin), flowSensorISR, RISING); // Interrupt on rising edge
}

void loop()
{
// Calculate flow rate every second
  if (millis() - lastMillis >= 100) {
    noInterrupts(); // Disable interrupts during calculation
    flowRate = ((1000.0 / (millis() - lastMillis)) * pulseCount) / calibrationFactor;
    lastMillis = millis();
    pulseCount = 0; // Reset pulse count
    interrupts(); // Re-enable interrupts

    Serial.print("Flow Rate: ");
    Serial.print(flowRate);
    Serial.println(" L/min");
    //SendToIPGauge1(flowRate);
    MyPanel.SetNumber(F("IPGauge1"), flowRate);
  }
}
// Interrupt Service Routine (ISR)
void flowSensorISR() {
  pulseCount++;
}

Re: the project works with arduino uno, but doesn't work with arduino nano neither arduino mega pro

Posted: Tue Dec 09, 2025 9:17 am
by philr
Does your new board use a different serial chip by any chance and is it a CH340?

https://learn.microsoft.com/en-us/answe ... er-windows

They released a driver a while ago through windows update that stops it working. You can download the old one here
https://learn.sparkfun.com/tutorials/ho ... rivers/all

Cheers
Phil