Loading...
  Show Posts
Pages: [1] 2
1  International / Hardware / Re: Multilinea su display 20x4 HD44780 compatibile on: October 10, 2012, 04:50:58 pm
Quindi, in pratica, dovrei creare delle procedure che puntano dove serve da richiamare quando mi servono con setCursor(x,y)?
Sarei curioso di capire perché hanno gestito la cosa così. Infatti, se uso "println" o "\n" ottengo sì il caporiga, ma anche dei caratteri strani (suppongo l'escape di EOL). Ma tant'è...

La rottura di scatole sta nel fatto che se mi serve nel loop diventa un po' farraginoso da gestire... non ci sono librerie che "sanno" di questa peculiarità?
2  International / Hardware / Multilinea su display 20x4 HD44780 compatibile on: October 10, 2012, 11:52:54 am
Salute a tutti!

Ho un problema con il mio progetto: in pratica, quando vado a capo (o la stringa è troppo lunga) su un display LCD 20 colonne x 4 righe mi salta una riga.

Invece di avere riga -> riga -> riga -> riga ottengo riga -> riga vuota -> riga -> riga vuota.
Il codice:

Code:
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
 
  lcd.begin(20, 4);
   lcd.setCursor(0,1);
 
  lcd.print("Questa è una stringa molto lunga solo per dimostrare che dovrebbe funzionare correttamente! ");

}

void loop() {

}


In pratica appare come l'ultimo esempio qui:

http://learn.adafruit.com/character-lcds/using-a-character-lcd


E' un problema della libreria LiquidCristal?

Grazie e saluti!
3  Using Arduino / Displays / Re: HD44780 20x4 issue (showing all squares) on: October 10, 2012, 05:32:24 am
Mmm... yesterday night i posted the images, but for a strange reason i can't find them now. I know it sucks, but if you don't have 10 fingers (and a breadbord) then it's a quite discrete job. I'll get a breadboard and let you know. Dhenry, where you talking about good ol' Edsger?
4  Using Arduino / Displays / Re: HD44780 20x4 issue (showing all squares) on: October 09, 2012, 05:00:18 pm
Horrible is a compliment. I know it's pitiful. It's a fast prototype, anyway, i'm doing exactly what is in the scheme by DEAFBOY. The only thing that changes, is that i'm taking two wires from the +5V of the Arduino: one to the potentiometer and the other on the supply of the LCD directly. Then it's exactly the same. I double and triple checked the connections and they are correct.
5  Using Arduino / Displays / Re: HD44780 20x4 issue (showing all squares) on: October 09, 2012, 02:34:15 pm
So, that is what i've done. sorry if it's a little bit confused, but this should clarify what i'm doing.
Let me know what you think!

Open -> Liquid Crystal -> HelloWorld



Meh, the only thing that changes from what i'm doing, is the 5V+ connected to the potentiometer. So nothing changes. Right?
6  Using Arduino / Displays / Re: HD44780 20x4 issue (showing all squares) on: October 09, 2012, 01:47:35 pm
So, that is what i've done. sorry if it's a little bit confused, but this should clarify what i'm doing.
Let me know what you think!
7  Using Arduino / Displays / Re: HD44780 20x4 issue (showing all squares) on: October 09, 2012, 05:44:32 am
Man i tried all the stuff above, i even connected the contrast pin to a digital out (pin 9) to select the voltage... like that:

Code:

void setup() {
  pinMode(9, OUTPUT);
  // set up the LCD's number of columns and rows:
  lcd.begin(20, 4);
  analogWrite(9, 145); //let's try...
  // Print a message to the LCD.
  lcd.print("hello, world!");
}


and the less value i put like

Code:
analogWrite(9, 20);

the bigger the contrast is. If i put analogWrite(9,200) i see like 0 contrast. But i can't see any data, only squares.

I think i burned something (like some driver, if there is any). smiley-sad
8  Using Arduino / Displays / Re: HD44780 20x4 issue (showing all squares) on: October 08, 2012, 02:11:20 pm
Thanks guys!
I've got a trimmer (10KOhms) but i'm having same issue with this code i found on the net and which i think should be correct (it has correct parameters on the constructor and has the lcd.begin statement). This is the code:

Code:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5,4,3,2);

void setup() {
//here's the lcd.begin for my display (it's a 20x4)

lcd.begin(20, 4);
lcd.print("Hello Arduino!");
}

//let's print time passing by...
void loop() {
lcd.setCursor(0, 1);
lcd.print(millis()/1000);
}


So, i don't think that there is something wrong. Don't think it's a matter of contrast, since i grounded the contrast pin too and gave him directly 3.3V, nor with the trimmer.

Do i have to buy another one? smiley-razz

Another tip: do i have to put a resistance on the backlight led or it is already "slowed down"?
9  Using Arduino / Displays / HD44780 20x4 issue (showing all squares) on: October 08, 2012, 11:25:57 am
Hello every1!

I'm having a trouble with a 20x4 LCD. I'm doing the simple "Hello world" as following:

Code:
#include <LiquidCrystal.h>

/* LiquidCrystal display with:
LCD 4 (RS) to arduino pin 12
LCD 5 (R/W) to ground (non-existent pin 14 okay?)
LCD 6 (E) to arduino pin 11
d4, d5, d6, d7 on arduino pins 7, 8, 9, 10
*/
LiquidCrystal lcd(12, 14, 11, 7, 8, 9, 10);

void setup()
{
// position cursor on line x=4,y=3
lcd.setCursor(3,2);
// Print a message to the LCD.
lcd.print("hello, world!");
}

void loop()
{
}

Obviously, every connection is made correctly. What i see is just like it's showing every pixel (a bunch of squares). Do i have burned something?

Thanks folks!
10  Using Arduino / Networking, Protocols, and Devices / Re: SerialEvent()... or what? on: January 23, 2012, 11:02:24 am
No: the GPS sends out "Ready" only when it turns on. After, it doesn't send "Ready" anymore. Good idea to use SoftwareSerial, i never used it, i think i'm gonna learn, and that's great smiley-grin

By the way, i still consider that there are errors on the interface. It's too strange that he doesn't clear the string. My curiosity stay there: why the string isn't cleared? It's like there is a sort of buffer that, indeed, doesn't exist. He seems to receive and send at same time, throwing a sort of loop that only stops when i phisically detach the RX pin on the Arduino. Next try is to detach serial port from the GPS to see if Arduino still repeats. That will be the confirmation that there are mistake in the code or in the interface smiley-wink
11  Using Arduino / Networking, Protocols, and Devices / Re: SerialEvent()... or what? on: January 23, 2012, 09:57:21 am
Nope... i have a GPS module that sends "Ready" once it's ready. After that, i can ask the module the string i need, but it only prints "Ready" one time. I checked with a terminal, interrogating the module and effectively it replies "Ready" after few seconds that he turns on. Maybe there's a flaw in the interface? What makes me think, is that in every loop, if the string is complete, i clean the inputString with

Code:
inputString = "";

but this doesn't seem to clean anything, because he repeats that string! It only stops when i detach RX pin. Ideas?

Many thanks!
12  Using Arduino / Networking, Protocols, and Devices / Re: SerialEvent()... or what? on: January 23, 2012, 03:23:41 am
Thanks for the reply. I looked for "READY\n" but it doesn't enter in the if statement.
For me it sound strange... nor i think i can check for "\n" char before, because then i don't know how to manage the entire string. Could you make an example, maybe i didn't understand right.

Thanks!

EDIT: I'm a little bit confused, but your solution works great! I just made this way:

Code:
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    if (inChar != '\n') {
      inputString += inChar;
    }
   
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }

   
  }
}

The only thing to adjust is that he repeats over and over the strings. The only way for stopping it is to detach rx or tx pin. Maybe there's a mistake with the interface? Or do i need something else?

Thanks again!
13  Using Arduino / Networking, Protocols, and Devices / SerialEvent()... or what? on: January 21, 2012, 04:22:47 am
Hi guys!

I have to implement communication via serial port. I have a GPS module which sends to Arduino (via Serial port, i made an interface to normalize tension with a simple MAX232 since the module works at +-12 or so).
Ok, communication between Arduino and GPS is fine, 'cause i can read the GPS sentences. I'm using the SerialEvent() example but i have a "little" problem: it just doesn't clear the inputString. Via serial monitor i see the same sentences repeated over and over very fast but it doesn't clear the string: i just see the sentences repeated very fast and it stops only when i detach the RX pin or when i power down the GPS. Nor i can't compare the string! If i make

if(inputString == "Ready")

where Ready is actually the string received by Arduino it seems that he doesn't enter in the 'if' condition.

Here's the code, which is nearly the original:

Code:
String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete

void setup() {
  // initialize serial:
  Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
}

void loop() {
  // print the string when a newline arrives:
  if (stringComplete) {
    Serial.println(inputString);
    /* this is where my added code is, but for some reason it doesn't work*/
    if(inputString=="Ready") {
       Serial.print("Ok, please begin");
    }
    // clear the string: this doesn't work.
    inputString = "";
    stringComplete = false;
  }
}

/*
  SerialEvent occurs whenever a new data comes in the
 hardware serial RX.  This routine is run between each
 time loop() runs, so using delay inside loop can delay
 response.  Multiple bytes of data may be available.
 */
void serialEvent() {
  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the inputString:
    inputString += inChar;
    // if the incoming character is a newline, set a flag
    // so the main loop can do something about it:
    if (inChar == '\n') {
      stringComplete = true;
    }
  }
}

What i have to think? Maybe there's a mistake on the MAX232 interface, like a loop on some pin, but... i don't think: i tried to look with an oscilloscope and i see what i'm expecting to see.

This is a weekend project, but i'm expecting it to work! smiley-wink

Thank you guys!
14  International / Italiano / Re: Arduino? si però..... on: January 21, 2012, 04:06:53 am
Per me l'IDE di Arduino è assolutamente perfetta.
Vuoi il minimale? Ce l'hai. Vuoi di più? Te lo crei. Altrimenti non usare Arduino.

Naturalmente IMHO.
15  Forum 2005-2010 (read only) / Italiano / Re: Stepper e ponte-h on: August 03, 2010, 04:00:07 pm
Ok! Quindi, se non ho capito male, io collego all'Arduino soltanto 4 pin (2 per ogni driver) e l'alimentazione invece va direttamente sul motorino? O sul driver? E, soprattutto, per l'alimentazione come faccio? Forse riesco ad avere il resto della stampante: i driver posso recuperarli da lì? Giuro che la faccio pezzo pezzo  ;D e mi prendo ciò che serve... però devi dirmi quali componenti devo cercare! Magari anche l'alimentatore potrei recuperarlo da lì... o no?
Grazie!
Pages: [1] 2