Уменя пока вот так (схема нужна) :
/*
This sketch uses the Adafruit i2c/SPI LCD backpack
and shares some code from Adafruit
(
http://www.ladyada.net/products/i2cspilcdbackpack/index.html )
Sketch produced by Mike Richards (G4WNC) for publication in the August issue
of Practical Wireless magazine in the UK
www.g4wnc.com The LCD Backpack connections:
* 5V to Arduino 5V pin
* GND to Arduino GND pin
* CLK to Analog #5
* DAT to Analog #4
* The AD8307 voltage output connects to the Arduino A0 pin
*/
// include the library code:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Initialise the variables
int value = 0; // Used to store the raw reading from the ADC
float vout = 0.000; // Holds the true value of the ADC output voltage
float powerdB = 0.00; // Calculated power in dBm
float pWatts = 0.00; // Calculated power in watts
float slope = 39.44; // Slope of the AD8307 log output (Default = 40)
float intercept = 47.0; // 0V intercept point (Default = 44)
float refVolts = 2.499; // Measured value of the 2.5V external reference
// Connect to the LCD via i2c, default address #0 (A0-A2 not jumpered)
//LiquidCrystal lcd(0);
LiquidCrystal_I2C lcd(0x27,16,2); // Задаем адрес и размер дисплея
void setup() {
// Start by setting-up the pin configurations
lcd.init();
analogReference(EXTERNAL); // Set the Arduino to use an external reference for the ADC
pinMode(4, OUTPUT); // Digital pin 4 is used to supply power to the voltage reference
digitalWrite(4, HIGH); // Make sure pin 4 is high
pinMode(A0, INPUT); // Enable the first (A0) input to the ADC
// set up the LCD's number of rows and columns:
lcd.begin(20, 4); // Set 4 lines of 20 characters
// Print a message to the LCD.
lcd.setCursor(0,0); // set the cursor to the top left, line 0 column 0
lcd.print(" Power "); // Message on the top line of the display
lcd.setBacklight(HIGH); // Turn the backlight on to make the display visible
//Now print the measurement labels
lcd.setCursor(0,1); // move the cursor to the first position on the 2nd line
lcd.print("Meter "); // print the label
lcd.setCursor(0, 2); // Move the cursor to the start of the 3rd line
lcd.print("Power (dBm): "); // Print the label
lcd.setCursor(0, 3); // Position the cursor
lcd.print("Power (Watts):"); // Print the label
}
void loop() {
value = analogRead(0); //read the ADC and store the result in value
vout = (value*refVolts)/1023; // Convert the ADC result to volts in vout
powerdB = (slope*vout)-intercept; // convert the voltage to dBm in 50 ohms
pWatts = pow(10.0,(powerdB -30)/10.0); // convert dBm to watts
lcd.setCursor(13, 1); //Move the cursor to the 13th position
lcd.print(vout,3); // Display the AD8307 voltage
lcd.setCursor(13, 2); // Position the cursor
lcd.print(" "); // Print spaces to clear the last result
lcd.setCursor(13, 2); // Position the cursor
lcd.print(powerdB,1);// Display the power in dBm
lcd.setCursor(15,3); // Position the cursor
lcd.print(" "); // Print spaces to clear the last result
lcd.setCursor(15,3); //Position the cursor
lcd.print(pWatts,1);// Display the power in watts
}