Arduino code Porting Please Help?

hi please can someone port this code from lcd - to serial output to pc thanks :) 

http://www.thebestcasescenario.com/forum/showthread.php?t=25092
/*Arduino Controlled Voltage Monitor
Code by Will Lyon 12/5/2010
Code for project Power House on TBCS
http://www.thebestcasescenario.com*/

#include <LiquidCrystal.h>

//Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);

void setup()
{
  lcd.begin(16, 2);                      //Set up the LCD's number of columns and rows
  lcd.print("  POWER  HOUSE");           //First line opening message
  lcd.setCursor(0, 1);
  lcd.print("Desktop Pwr Unit");         //Second line opening message
  delay(5000);
  lcd.setCursor(0, 1);                   //Clear bottom line
  lcd.print("                ");
  lcd.setCursor(0,0);
  lcd.print(" 3v    5v   12v");          //Update top line readout
}

void loop()
{
  lcd.setCursor(0, 1);
  float f = analogRead(0) * 4.88 / 1023;   // 3.3 => 9.9
  lcd.print(f, 2);                        // print float with two decimals


  lcd.setCursor(6, 1);
  float g = analogRead(1) * 8.5 / 1023;   // 5.0 => 9.9
  lcd.print(g, 2);

 
  lcd.setCursor(11, 1);
  float h = analogRead(2) * 17.25 / 1023;  // 12.0 => 25.0
  lcd.print(h, 2);

  delay(1000);
}

maewert5 years ago
Not sure what you really want, but if you replace the LCD lines with calls to the serial libraries it might be what you want:

/*Arduino Controlled Voltage Monitor
Code by Will Lyon 12/5/2010
Code for project Power House on TBCS
http://www.thebestcasescenario.com*/

void setup()
{
  // start serial port at 9600 bps:
  Serial.begin(9600);
}

void loop()
{
  float f = analogRead(0) * 4.88 / 1023;   // 3.3 => 9.9
  Serial.print(f, 2);                        // print float with two decimals


  float g = analogRead(1) * 8.5 / 1023;   // 5.0 => 9.9
  Serial.print(g, 2);


  float h = analogRead(2) * 17.25 / 1023;  // 12.0 => 25.0
  Serial.print(h, 2);

  delay(1000);
}


Best Wishes