English 中文(简体)
液晶体 与Arduino的方案拟订工作
原标题:Liquid Crystal LCD Programming with Arduino?

我希望我的LCD显示“Voltage=(传感器Value)”,但现在,我获得该方案承认这一价值的唯一途径是,如果我把它 put在一旁的话。 但是,当我把它放入一个坡道时,整个屏幕上填满了1、2、3、4或5个,取决于立立强计的地点。

If I don t have it in a loop then whatever setting the potentiometer is on is what will pop on the screen and will not change if potentiometer is turned.

我怎么能够把休闲结果置于休闲之外,以便我能够“(Voltage=传感器Value)”?

Here s my program:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  

void setup()
{
    lcd.init();                      
    lcd.backlight();
    int sensorPin = A0;
    int sensorValue = 0;
    sensorValue = 0.004882812 * analogRead(sensorPin) + 1;
    lcd.print("Voltage=");
}

void loop()
{
    int sensorPin = A0;
    int sensorValue = 0;
    sensorValue = 0.004882812 * analogRead(sensorPin) + 1;
    lcd.print(sensorValue);
}
问题回答

This is what I came up with last week. Thanks for all the advice guys!

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);  

void setup() {}

void loop()
{ lcd.init();                      
lcd.backlight();

int VoltsInput = A0;
int VoltsRange = 0;
int VoltsPercent = 0;

VoltsRange = (5.0/1023.0) * analogRead(VoltsInput);
VoltsPercent = (((5.0/1023.0) * analogRead(VoltsInput)) / 5) * 100;

lcd.print(VoltsRange);
lcd.print("V    ");

lcd.print(VoltsPercent);
lcd.print("%");}

规定它属于 lo,并使用一种延迟功能,使贵方案能够读出每秒钟而不是每秒钟的pot。

It sounds like print() is clearing the screen of previous data every time it is called (although the relevant documentation and library code available here and here is unclear).

如果是的话,你需要印刷<代码>。 Voltage= string in the loop with the 传感器 Value. 1. 修改你的法典如下:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  
int sensorPin = A0;

void setup()
{
    lcd.init();                      
    lcd.backlight();
}

void loop()
{
    int sensorValue = 0.004882812 * analogRead(sensorPin) + 1;
    String display = "Voltage=";
    display += sensorValue;
    lcd.print(display);
}




相关问题
Is there a listing of the video drivers in the Linux kernel?

I m trying to pick an small (< 4") touchscreen TFT/LCD. Because I m no stranger to LCD/TFT linux driver development (I did one for an Epson chip), I d rather pick one that is supported directly by ...

Programming rs232 to lcd (Linux)

I m using a pc1602f PowerTip directly connected to the PC parallel port using this scheme: http://www.beyondlogic.org/parlcd/parlcd.htm All well as energizes the LCD and shows me the front row with ...

Using iPhone LCD with Arduino

Is it possible to use any LCD with Arduino or do I need to stick to some for which the libraries are available? I m just starting out with Arduino and know nothing about interfacing LCDs with ...

Tips for developing a LCD display emulator

I d like to develop a PC LCD display emulator for educational purposes. The display uses HD44780. I don t know where to start.

lcd initialisation

void lcdinit(void) { command1( 0x03 ); command1( 0x03 ); command1( 0x03 ); delay1(20); command1( 0x02 ); //lcd home delay1(10); Command( 0x28 ); delay1(10); Command( 0x08 ); //display of cursor ...

Java monospace draw string

How can I draw a String in Java (using Graphics2d) in monospace mode? I have a font that looks like LCD screen font, and I want to draw something like LCD label. I am using Digital 7 Mono font. Do ...

How to send info to LCD from web

I have seen applications capable of sending information to Logitech LCD panels and played with that a bit a few years ago. Currently, I have four small LCD panels. Two are CrystalFontz 633s, one ...

热门标签