First step (SWR-meter).

Hello all!

I am very new in programming and this is my first skatch. The goal was to build an SWR-meter. The signals will be read from ADC0 and ADC1, calculate SWR and Power and than displayed on LCD-display. Is any mistakes in my skatch?

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
float forward;
float reflection;
float val;

void setup() {
   lcd.begin (16,2);
   }

void loop() {

forward = analogRead(0);
reflection = analogRead(1);
val = 0;
val = forward * 0.098;
lcd.clear();
lcd.setCursor(3, 0);
lcd.print("Power=");
lcdPrintFloat(val, 1);
lcd.setCursor(5, 1);
lcd.print("SWR=");
val = 0;
val = ((forward + reflection) / (forward - reflection));
lcdPrintFloat(val, 1);

delay (100);

}

void lcdPrintFloat (float val, byte precision) {
  lcd.print ((long)val);
  if (precision > 0) {
    lcd.print (".");
    unsigned long frac;
   unsigned long mult = 1;
  byte padding = precision -1;
 while (precision--)
           mult *=10;
     if (val >= 0)
           frac = (val - int(val)) * mult;
      else frac = (int(val) - val) * mult;
 unsigned long frac1 = frac;
while( frac1 /= 10 )
        padding--;
while( padding-- )
        lcd.print("0");
lcd.print(frac,DEC);

  }}

Thanks!

Can you edit your post and re-insert your code using code tags (the # button) so we can see your indentation correctly?