Show Posts
Pages: 1 ... 33 34 [35] 36 37 ... 43
511  Using Arduino / Displays / Re: Advanced Scrolling on 16 x 2 LCD with user input at the same time on: March 02, 2011, 06:30:32 pm
I found something that works great, ...scrolls the top line, no matter how long the string is, and lets me put data in the bottom line without worrying about where ther top line is:
Thanks to JeffB42 at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1246484182
I had to add the begin(16,2) line...
512  Using Arduino / Displays / Re: Advanced Scrolling on 16 x 2 LCD with user input at the same time on: March 02, 2011, 06:11:02 pm
Quote
Will this library work for a 16 x 2 display?
Why wouldn't it?  It is promoted as an enhancement with additions to do various features.  See: http://code.google.com/p/liquidcrystal440/

Don
I did, and downloaded it, but there were no examples... 
513  Using Arduino / Displays / Re: Advanced Scrolling on 16 x 2 LCD with user input at the same time on: March 02, 2011, 05:51:23 pm
I've got this working, scroll text on the top, and posting a user input number on the bottom, in the center.  Not sure how it works, but it works, so I guess it'll do to incorporate into my main sketch.  If there's an improvement on this out there, I'd like to know about it...
Code:
/*
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

String str1 = "Select 2-12 cups, & press *    ";  // using a constant String
String strClear = "                  ";
long previousMillis = 0;        // will store last time LCD was updated
long interval = 400;           // interval at which to update LCD (milliseconds)
int UserData = 2;    //input from serial monitor
int MyNumber = 13;

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16,2);
  Serial.begin(9600);
}

void loop() {
//str1 = str1 + strClear;

  int i;
  int j = 17;
  lcd.setCursor(16,0);

  for (i = 0; i < str1.length() ; ) {
    // wait without delay:
    unsigned long currentMillis = millis();
 
    if(currentMillis - previousMillis > interval) {
      //update last LCD write
      previousMillis = currentMillis;   
      Serial.println(i);
//      if(i==24) lcd.setCursor(i,1);
      if (i==23) j=-23;
      lcd.print(str1.charAt(i));
      lcd.scrollDisplayLeft();
      lcd.setCursor(6+i,1);

      lcd.print("  ");
      lcd.print(MyNumber);
//      lcd.print(" " + UserData);
      lcd.setCursor(j+i,0);
      i++;
    }
    //Check for keypress event here
    CheckSerial();
  }
  // clear screen for the next loop:
  delay(2000);
  lcd.clear();
}


void CheckSerial(){
  if (Serial.available() > 0) {
      // get incoming byte:
      MyNumber = Serial.read();
  }
514  Using Arduino / Displays / Re: Advanced Scrolling on 16 x 2 LCD with user input at the same time on: March 02, 2011, 05:43:24 pm
Quote
I believe this action has been implemented in the LiquidCrystal440 library.
Will this library work for a 16 x 2 display?  I looked at it but it looked like it was set for 40x4.
Is there an example sketch of it somewhere working on a 16x2?
thanks
515  Using Arduino / Displays / Test scrolling without delay on: March 02, 2011, 04:20:18 pm
This actually scrolls without delay!  But it still doesn't work. smiley-sad
Can someone tell me why the end of the string switches to the bottom row, or better yet tell me how to fix it!
thanks.

Code:
/*
 Demonstrates the use a 16x2 LCD display.  The LiquidCrystal
 library works with all LCD displays that are compatible with the
 Hitachi HD44780 driver. There are many of them out there, and you
 can usually tell them by the 16-pin interface.
 
 The circuit:
 * LCD RS pin to digital pin 12
 * LCD Enable pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD R/W pin to ground
 */

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

String str1 = "'Hello World' was not long enough";  // using a constant String
String strClear = "                  ";
long previousMillis = 0;        // will store last time LCD was updated
long interval = 300;           // interval at which to update LCD (milliseconds)

void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16,2);
  Serial.begin(9600);
}

void loop() {
str1 = str1 + strClear;

  int i;
  lcd.setCursor(16,0);

  for (i = 0; i < str1.length() ; ) {
    // wait without delay:
    unsigned long currentMillis = millis();
 
    if(currentMillis - previousMillis > interval) {
      //update last LCD write
      previousMillis = currentMillis;   
      Serial.println(str1.charAt(i));
      lcd.print(str1.charAt(i));
      lcd.scrollDisplayLeft();
      i++;
    }
  //Do something else here, like check keypress events
  }
  // clear screen for the next loop:
  lcd.clear();
}
516  Using Arduino / Displays / Re: Advanced Scrolling on 16 x 2 LCD with user input at the same time on: March 02, 2011, 03:08:26 pm
I'd like to figured out this scrolling a little more.  Does anyone know of some good tutorials on advanced scrolling?  I've noticed that this LCD must have 40 spaces across a line, even though you can't see them, because it take 39 chars before it start wrapping to the next line.  I'm just using the standard library that came with the Arduino 0022.
517  Using Arduino / Displays / Advanced Scrolling on 16 x 2 LCD with user input at the same time on: March 02, 2011, 11:38:09 am
...maybe this isn't advanced to some folk, but it sure is to me!  I'm having trouble figuring this out and my code just gets worse and worse.  Here's what I'm trying to do:
Scroll this message across the top line of the LCD:
         
Code:
String stringOne = "Enter the number of cups, followed by the '*' ";
And then have the blinking cursor in the center of the second line.  The users input will be displayed here.  Input is coming from a keypad set up like the hellokeypad demo, so this would get the key press:
       
Code:
  char key = keypad.getKey();

I'm at a loss--the autoscroll function uses delay() to scroll the text, but I will miss key presses with that method.  And then there's this:  I'd really like the user to be able to enter the numbers 10 and 12, which means 2 keypresses, saving the first digit, the second digit, adding them together, checking for the '*' keypress, still auto scrolling...  It's almost overwhelming!  If this all sounds fairly simple to someone, could you please post a little code on how to do it?

Thanks!
518  Using Arduino / Motors, Mechanics, and Power / Re: simple current sensing circuit for small gearmotor on: March 01, 2011, 12:12:15 pm
My Sparkfun gearmotor, running on 5V, draws 89 mA with no load.  If I put a bit of load on it, (what I consider more than adequate for my installed application) it's about 150-200 mA.  So I will make it a little above that.  This is just what I've been looking for...
519  Using Arduino / Motors, Mechanics, and Power / Re: simple current sensing circuit for small gearmotor on: March 01, 2011, 11:50:01 am
option #2:
I just found this:
http://www.romanblack.com/current.htm
This looks like it would do just what I need.  The schematic doesn't give a Rsense value, it says to have .05 volts.  So, a 1 ohm resistor would probably work if I'm using 5 volt to power the motor?
520  Using Arduino / Motors, Mechanics, and Power / simple current sensing circuit for small gearmotor on: March 01, 2011, 11:38:54 am
I'm wondering if there's a simple way to use an op amp that radio shack sells (LM741 or LM324) to measure the current drawn from SparkFun's mini gearmotor.
90mA @ 6V
800mA stall current @6V

If I power it with 5 volts,  could I measure the voltage difference across a 1 ohm resistor in series with the motor, with one of these op amps?  Not quite sure just what other resistors I'd need to get an output that an analog pin could read.
521  Using Arduino / Motors, Mechanics, and Power / Re: adding PWM to this great motor control: on: March 01, 2011, 11:04:27 am
Thanks, controlling the motor via PWM could be very useful.
522  Using Arduino / Motors, Mechanics, and Power / Re: adding PWM to this great motor control: on: March 01, 2011, 01:45:17 am
Okay, I just didn't want to hurt anything...
523  Using Arduino / Motors, Mechanics, and Power / adding PWM to this great motor control: on: March 01, 2011, 12:23:09 am
This works GREAT, for my Sparkfun 100:1 mini gearmotor.
http://itp.nyu.edu/physcomp/Labs/DCMotorControl
I'm curious, instead of 2 digital pins, could I use 2 analog pins and control the speed with PWM?
524  Using Arduino / Motors, Mechanics, and Power / Re: setting an angle on a continuous rotation servo on: February 28, 2011, 01:14:32 am
...sorry if I'm repeating myself.  To state the obvious, I'd like to get away from limit switches and sensors if possible.  I'm new to this stuff, and just wondering about the power of a stepper motor.  I didn't know a motor could have power at low speeds.  I'm used to motors running 1600-1700 RPM, what you'd find on a bench grinder.  I had no idea a motor could run this slow, but if a printer head motor doesn't use gear reduction, then it must be able to run pretty slow, which sounds like a perfect solution to me--a nice slow drawer opening with digital control as to it's where abouts, so no need of sensors or limit switches. 

525  Using Arduino / Motors, Mechanics, and Power / Re: setting an angle on a continuous rotation servo on: February 28, 2011, 01:02:08 am
...so, SparkFun's stepper motor wouldn't have enough power (torque) to open a drawer?
Pages: 1 ... 33 34 [35] 36 37 ... 43