Need help making Gas level gauge using Whadda WPI471 bar graph module

Hello people, I am trying to build a gas level gauge for my tractor using the Whadda WPI471 bar graph module and a Fuel Level Sensor (0-190ohms).

I installed the Whadda LED bar graph in the Library and downloaded there Demo.ino and the LED Bar Graph is working fine.

However, I am new to Arduino and have no ideas how to make the code so to have the Fuel Level Sensor, which is basically a 190 ohms potentiometer, set the lever on the Whadda WPI471 bar graph module?

The current Demo.ino code basically loops the LEDs from none to all LED illuminating.

How can I modify the codes so it would work like a bar graph fuel gauge?
(The fuel level sensor is like using a 190 ohms potentiometer)

Here is my current code:

#include <BarGraph.h>

//pins definitions for LED bar graph module (can be changed to other pins)
#define CLK 3 // CLK pin
#define DIO 2 // DIO pin

BarGraph bargraphDisplay(CLK,DIO); // Create BarGraph module object, setup pins

void setup()
{
  bargraphDisplay.init(); // Initialise bar graph module
  bargraphDisplay.set(BRIGHTEST); // Set brightness, BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
}
void loop()
{
    bar_display(); // Show bar mode display example
}


// BAR MODE EXAMPLE
void bar_display()
{
  for(int i=0; i<8; i++) {
    bargraphDisplay.setLevel(i); // Set bargraph bars up to level i
    delay(600);
  }
}

Here is how it is currently wired up for the Demo.ino

Any help would be greatly appreciated...

Here's a WOKWI sample.

How are you planning on compensating for the tank shape and if it is moving the sloshing will also cause problems that you need to consider. What type of sender are you planning on and what is its signal like?

Ok I have created a new post here: https://forum.arduino.cc/t/creating-a-fuel-gauge-using-16x-neopixels/1218344

I am wanting to do this using 2 x NeoPixel RGB LED Strip with 8 x WS2812B.

Please disregard this post and any help with the project above would be much appreciated.

Cheers

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.