Show Posts
Pages: 1 [2]
16  Using Arduino / Displays / Re: lcd created random caracters on: April 01, 2013, 10:52:31 am
Your wire up is too messy, you need to move communication cables far from things that can cause any interference, such as motors.
17  Using Arduino / Displays / Re: Using a Sanyo LC7582 as lcd on: March 31, 2013, 07:38:01 pm
You may want to start reading the following web sites

http://playground.arduino.cc/Code/LCD
http://workshops.ist.utl.pt/arduino-lessons/lesson-ii-2-interfacing-with-an-lcd/

Then, if you don't find anything suitable for your LCD, you may need to write the driver for your particular LCD, you can always use one of the available LCD drivers as starting point.
18  Using Arduino / Displays / Re: I2C LCD, first project, need help! on: March 31, 2013, 02:34:20 pm
I had a similar problem with an 16x2, reconfiguring the wiring solved the problem, check the following tutorial

http://www.ucontrolit.tv/arduino-bb1/
19  Using Arduino / Displays / Re: I2C lcd digital clock problem.HELP! on: March 31, 2013, 02:25:46 pm
You need to lock the minute counter once it increases, see bellow the modified loop:


Code:

bool minlock = false;  // <----- minute counter lock

void loop()
{
  unsigned long currmillis=millis();
  //detecteaza apasare buton
/*   
  if(digitalRead(buttonHr)==HIGH)
  {
    delay(25);
    hrs=hrs+1;
    updateHrs();
    //actualizeaza AMPM la apasare buton
    if(hrs==12)
    {
      updateAMPM();
    }
    delay(300);
  }
*/
/*
  if(digitalRead(buttonMin)==HIGH)
  {
    delay(25);
    mins=mins+1;
    //Serial.println(mins);
    updateMin();
    delay(300);
  }
*/
  if(currmillis-prevmillis < 999)
  {
    //lcd.clear();
    prevmillis=currmillis;
    //lcd.setCursor(0,1);
    //lcd.print(currmillis);
    if(secs < 10)
    {
      lcd.setCursor(12,0);
      lcd.print(secs);
      lcd.setCursor(11,0);
      lcd.print(0);
    }
    else
    {
      lcd.setCursor(11,0);
      lcd.print(secs);
    }
    //obtine secunde de la timpul sistemului
    secs=(millis()/milliDivsecs)%60;      //da secundele din milisecunde
    //afisare minute
    // it seems here is a better place for this part of code
    if((secs == 59) && (minlock == false))
    {
      mins=mins+1;
      updateMin();
      minlock=true; // <--- lock mininute counter
    }
    else if (secs != 59)
    {
      minlock=false; // <--- unlock mininute counter
    }
  }
}
20  Using Arduino / Displays / Re: LCD Servo Position ? on: March 29, 2013, 07:23:58 pm
Nice code I just added some adjustment to your code that maybe useful, check the lines with (<------)

Code:
#include <Wire.h>
 #include <LiquidCrystal_I2C.h>
 #include <Servo.h>

 LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 20 chars and 4 line display
 Servo myservo;  // create servo object to control a servo

 int potpin = 0;  // analog pin used to connect the potentiometer
 int val;    // variable to read the value from the analog pin

 void setup()
 {
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object  
 
    lcd.init();                      // initialize the lcd
    lcd.backlight();
    lcd.setCursor(3,0);
    myservo.write(0);  // <------ put the servo at zero
    
  }

  void loop()
  {
  val = analogRead(potpin);            // reads the value of the potentiometer (value between 0 and 1023)
  //val = map(val, 0, 1023, -10, 160);     // scale it to use it with the servo (value between 0 and 180)
  pos = map(val, 0, 1023, 0, 180);            // <----- (value between 0 and 180)
  myservo.write(val);                  // sets the servo position according to the scaled value
  lcd.setCursor(3,0);
  lcd.print("   ");  // This covers up the previous value
  lcd.setCursor(3,0);
  lcd.print(val);
  delay(15);                           // waits for the servo to get there
  }
21  Using Arduino / Displays / Re: HD44780 16x2 LCD won't work with my Uno on: March 28, 2013, 01:21:30 pm
Make sure you have the same pin out as in that tutorial, take your time reading the following tutorial:

http://tronixstuff.wordpress.com/2011/01/08/tutorial-arduino-and-monochrome-lcds/
22  Using Arduino / Displays / Re: Simple circle on Nokia LCD on: March 28, 2013, 11:00:25 am
Enjoy

Code:
// Sketch to draw circles in the Nokia 5110 LCD
// http://learn.adafruit.com/adafruit-gfx-graphics-library/graphics-primitives

#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);

void setup()   {
  //Serial.begin(9600);
  display.begin();
  display.setContrast(60);
  delay(2000);
  // clears the screen and buffer
  display.clearDisplay();   
}

void loop() {
  // draw circles with center pooint at the center of the screen
  // upto "display.height()" pixel radius
  for (int16_t i=0; i<display.height(); i+=2) {
    display.drawCircle(display.width()/2, display.height()/2, i, BLACK);
    display.display();
    delay(100);
    display.clearDisplay();
  }
}


23  Using Arduino / Displays / Re: Connecting 9 pin Chacter LCD Display to the Arduino Mega 2560 on: March 26, 2013, 08:14:12 pm
I passed Today by a second hand shop and I show few devices with nice dot matrix LCD ready to be hacked, but you can get a LCD Display HD44780 in ebay for a couple of dollars, another nice option is the  Nokia 5110, but you will need a CD4050 CMOS HEX Buffer to lower the power because it runs at 3.3V:

http://learn.adafruit.com/nokia-5110-3310-monochrome-lcd
24  Using Arduino / Displays / Re: Midas I2C LCD 16x2 on: March 26, 2013, 09:59:48 am
Use the wiring tutorial above, and try to figure out the right pin out of you LCD modifying this part of the code

#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

If you don know the I2C_ADDR, run the following code to find it out:

Code:
// --------------------------------------
// i2c_scanner
//
// Version 1
//    This program (or code that looks like it)
//    can be found in many places.
//    For example on the Arduino.cc forum.
//    The original author is not know.
// Version 2, Juni 2012, Using Arduino 1.0.1
//     Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26  2013
//    V3 by louarnold
// Version 4, March 3, 2013, Using Arduino 1.0.3
//    by Arduino.cc user Krodal.
//    Changes by louarnold removed.
//    Scanning addresses changed from 0...127 to 1...119,
//    according to the i2c scanner by Nick Gammon
//    http://www.gammon.com.au/forum/?id=10896
//
//
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//

#include <Wire.h>


void setup()
{
  Wire.begin();

  Serial.begin(9600);
  Serial.println("\nI2C Scanner");
}


void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 120; address++ )
  {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknow error at address 0x");
      if (address<16)
        Serial.print("0");
      Serial.println(address,HEX);
    }   
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
}


Don't forget to open the Serial Monitor.
25  Using Arduino / Displays / Re: Connecting 9 pin Chacter LCD Display to the Arduino Mega 2560 on: March 26, 2013, 09:54:25 am
Did you check that the display is not a Segment LCD with fixed (in hardware) characters? If so you can only use the same symbols. You need a Dot Matrix or Graphic LCD that can be used a general purpose display.
26  Using Arduino / Displays / Re: Connecting 9 pin Chacter LCD Display to the Arduino Mega 2560 on: March 25, 2013, 08:52:59 pm
Try to do some reverse engineering, you can use 3.3V and some wires and just try systematically to decipher the connections, if you don't see anything probably you will need to try with 5.0V. I just Googleed and I found plenty of tutorials for reverse engineering LCD displays

http://justpushbuttons.com/blog/?p=263

27  Using Arduino / Displays / Re: Midas I2C LCD 16x2 on: March 25, 2013, 06:33:28 pm
Use the library from here

https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads

maybe this wiring tutorial is easer to understand:

http://www.ucontrolit.tv/arduino-bb1/
28  Using Arduino / Displays / Re: 16 x 2 display only shows left 8 characters ? on: March 25, 2013, 06:30:30 pm
Try again with

https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

use the version: LiquidCrystal_V1.2.1.zip

and then load this code:

Code:
/*
Tested on Arduino 1.0.3
UcontrolIt.TV
Bulding Block 1 - Sketch 1 Serial LCD

Test Sketch for the YwRobot Arduino serial LCD adapter - LCM1602 IIC V1

This may be the same as the Sainsmart I2C LCD2004 adapter but we havent tested it.

This example uses F Malpartida's ( http://www.electrofunltd.com/ )  NewLiquidCrystal
library available from:

https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads

You need to copy the new library to your Arduino libraries folder!

Mark Johnson
uControlIt.tv
December 2012

License: GNU General Public License

*/

// Load Libraries
//#include
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Define variables

#define I2C_ADDR 0x20  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

//Initialise the LCD
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup()
{
// Define LCD as 16 column x 2 rows
  lcd.begin (16,2);

// Switch on the backlight
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);

// Goto first column (0 not 1!), first line (0 not 1!),
  lcd.setCursor ( 0, 0 );

// Print at cursor location
  lcd.print("UControlIt.TV");

// Go to first column (0 not 1!), second line (which is 1 not 2!)
  lcd.setCursor ( 0, 1 );

// Print at cursor location
  lcd.print("Count:");

}

void loop()
{
 lcd.setCursor ( 7, 1 );
 lcd.print(n);
 n=n+1;
 delay (1000);
}

The code is from

http://www.ucontrolit.tv/arduino-bb1/

but I did change the I2C address to 0x20

Pages: 1 [2]