Pages: [1]   Go Down
Author Topic: question of code display  (Read 476 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i connect ct sensor to arduino and i connect lcd to arduino.
i want to read analog input (current of lamp) and display the value to lcd
this code is true:




#include <LiquidCrystal.h> // include the LCD library
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int analogPin = A0;
int val = 0;

void setup()
{
  Serial.begin(9600);          //  setup serial

lcd.begin(16, 2); // lcd rows and columns
    lcd.print("lampe"); // title
}

void loop()
{
  val = analogRead(analogPin);    // read the input pin


lcd.setCursor(0, 1);

  lcd.print("lampe=");
   lcd.print(val);
  Serial.println(val);             // debug value
}

Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8697
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What is the question?
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if code is true?
Logged

Gosport, UK
Offline Offline
Faraday Member
**
Karma: 21
Posts: 3113
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Does it compile? What happens when you run it?

You might need to add
Code:
#include <Wire.h>
at the top.
« Last Edit: November 27, 2012, 05:33:06 am by dxw00d » Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 201
Posts: 8697
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

if code is true?

If you are asking if the code does what you want it to, only you can answer that.  Run the code and see.  It will not harm your Arduino to try.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: