Skip to content

Instantly share code, notes, and snippets.

@D1plo1d
Created May 25, 2010 03:51
Show Gist options
  • Save D1plo1d/412742 to your computer and use it in GitHub Desktop.
Save D1plo1d/412742 to your computer and use it in GitHub Desktop.
// include the library code:
#include <LiquidCrystal.h>
int ammeter_pin = 0;
int amps_per_volt = 1; //amps per volt measured on the ammeter pin
int voltmeter_pin = 1;
int volts_per_volt = 1; //volts per volt measured on the voltmeter pin
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// set up the LCD's number of rows and columns:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("starting HUD..");
}
void loop() {
// print the voltage
lcd.setCursor(0, 0);
lcd.print("volts: "+analogRead(ammeter_pin)*amps_per_volt);
// print the current
lcd.setCursor(0, 0);
lcd.print("amps: "+analogRead(voltmeter_pin)*volts_per_volt);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment