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...