Yes! It's working like a champ!
Already have my arduino and the lcd hooked up on a breadboard, so just plugged in, uploaded sketch and badabing bada boom!
I did a quick search, and I'm sure I looked for the wrong thing, but is there a way to turn read values from the board into the spi bits? Or whatever it is I need to input them on the screen?
I'm just looking to do some basic interfacing right now.
If you want to for example take a an Analog read and print it on the screen, you can add this code to the bottom of the example (before the close bracket)
// Put this at the top - just about the void setup()
int analogValue;
char analogString[4];
// Put this just before the last closing bracket - just after the nokiaLcd.lcd_clear(BLACK,0,0,131,131);
analogValue = analogRead(0);
itoa(analogValue, analogString, 10);
strcpy(text,analogString);
nokiaLcd.lcd_draw_text(YELLOW, BLACK, 35, 5, text);
delay(2000);
nokiaLcd.lcd_clear(BLACK,0,0,131,131);
Also, please tell me how you connected the display to the Arduino? If you could, please take some pictures of your Arduino and the breadboard!
Awesome, works perfectly, thanks again! Well while I'm posting to such a skilled coder, haha how do I go about changing the background color?
Now, with the sample sketch, and any time I clear the LCD every 2 seconds or so, the background will stay black when it's displaying the text, but the screen resets every 2 seconds, I'm sure there's an easier way!
And I would take pictures.. haha I just tried and let's just say my pictures aren't worth nearly a thousand words..
I couldn't even make out what half of the stuff was in the picture, haha I tried semi-close and far away, was either too blurry or just too far away.
Though, I will explain how I hooked up the pins! (And be advised, the LCD I purchased has an onboard dc-to-dc booster (lol think thats the right word) where alot of the 6610s need an external power supply.)
Arduino
Digital pin 2: BL (Back Light controller)
Digital pin 3: CS (Chip Select)
Digital pin 4: SCLK (Serial Clock)
Digital pin 5: SDATA (Serial Data)
Digital pin 6: RESET (lol, Reset!)
Arduino 5 Volt : VCC (Power), And VBL(Voltage Booster for 7v backlight)
Woot!
I have a very-ghetto "Etch-a-Sketch" sketch at the moment! Complete with X and Y indicator!
/*
Nokia LCD Demo - A demo using the NokiaLCD library for a Nokia LCD with the epson driver.
Created by Thomas Jespersen, July 2009 (Originally Arduino Sketch by Gravitech.us)
Released into the public domain.
Edit by CaptainObvious - Ghetto Etch A Sketch
*/
#include <NokiaLCD.h>
// Nokia LCD Setup settings
#define RED 0xE0
#define GREEN 0x1C
#define BLUE 0x03
#define YELLOW 0xFC
#define MAGENTA 0xE3
#define CYAN 0x1F
#define BLACK 0x00
#define WHITE 0xFF
NokiaLCD nokiaLcd;
int potPin = 2; // X Position
int potPin2 = 3; // Y Position
int lcdDraw = 0;
int lcdDraw2 = 0;
char analogString[4];
char analogString2[4];
void setup()
{
DDRD |= B01111100; // Set SPI pins as output
PORTD |= B01111100; // Set SPI pins HIGH
nokiaLcd.lcd_init();
delay(500);
}
void loop()
{
char text [50]; // Not 100% sure if this is text size or what
analogRead(potPin);
analogRead(potPin2);
itoa(lcdDraw, analogString, 10); // Not really sure what itoa is, but it's important!
itoa(lcdDraw2, analogString2, 10);
strcpy(text, analogString); // First pot # input, printed in BLUE
nokiaLcd.lcd_draw_text(BLUE, BLACK, 100, 115, text);
strcpy(text, analogString2); // Second pot # input, printed in RED
nokiaLcd.lcd_draw_text(RED, BLACK, 100, 105, text);
lcdDraw = analogRead(potPin)/8;
lcdDraw2 = analogRead(potPin2)/8;
nokiaLcd.LCD_put_pixel(RED, lcdDraw, lcdDraw2);
}
Will be adding a button to clear screen shortly, and when it shows the position, once it's above 100, 3 Digit spots open, and the last digit is filled with a 0 if it's below 100. So anything that's < 100, will show up as "990" when it should be 99, "420" when it should be 42, etc.
But other than that, I can't thank you enough Thomas!
I'm also hoping to add a menu option, be able to choose etch a sketch or a couple other ideas, but first things first!
Well I've been becoming an artist over night! (hardly)
Now I'm stuck with creating a menu, or menus! (And many other things but this feels important) I'm guessing I'll be editing my .cpp and actually code in the screens, I'm just not sure how to use words as input? I guess? Being able to highlight my selection as I scroll up and down. Using either 2 buttons for up and down, 1 for select, or just a potentiometer I'm using for drawing, for a menu selection tool.
I got down how to change the background color of text only, not the background color of the whole LCD. So animating the highlighting would be easy, just coding the selection part is my problem! Not even sure what to ask, or where to begin, hope I got it out right!
Sounds good... Very nice project you've made
About the connection, don't you need any voltage converter for the different lines? Aren't the display running on 3.3V!
I have a display with voltage booster for the backlight too - Color LCD - Breakout Board - LCD-08600 - SparkFun Electronics
About the backlight color, you can use (change, as it's already in the code) this code line.
nokiaLcd.lcd_clear(BLACK,0,0,131,131);
The lcd_clear command just makes a square box with the color,x1,x2,y1,y2 parameters! I hope you understand that
Also, I can see that you don't know what the "itoa" command is.
It's a integer to string command, which converts a integer to a string so it can be used as a char* parameter.
There is also the "atoi" command, which converts a string (char*) with numbers into a integer value.
Sprintf can do the same as both of them, but it use 1.5K of code, while theese only use a couple of bytes
Actually I have both the BL and VCC connected to 5v. No problems so far, hope I don't damage anything :-X
Well, when I use the lcd_clear command, it does just that, it clears. When I have any information on the screen, it just looks like it's flashing because it keeps looping, and if I put in a delay, it just flashes, but slower.
And yes I understand the parameters, I think, haha battle ship! But minus the letters. As for the itoa, doesn't make too much sense to my noobness at the moment, but slowly but surely everythings making more sense.
You can change the X1,X2,Y1,Y2 parameter to only clear an area... So if you want to flash the background of only a little area (making a flashing box) you could do this:
Actually, I have the 6610, I believe the one you're using is the 6600. I read your first post, I have the same controller as yours. Well here, check this website, it has everything I started with lol the newbie code, and there are some amazing PDFs
There's a like 130 page tutorial on how to write code for the LCD driver, but it's just way above my head.
And @ the flashing, I don't want it to flash! haha, I'm just looking for a background color. (I just fixed it, turns out I had the lcd_clear in my loop.. so no wonder it was going to flash really fast)!
Using nokiaLcd.lcd_clear(BLACK, 0, 0, 131, 131);
The background does turn black, but it blinks very fast, not a background.
EDIT:
Oh, ... reading the main reason for this post, lol
When I was hooking up the screen for power, uh, I'm not sure if it would be parallel or series, but I ran 5v to the power rail on the bread board, and spread the power out there, including both the VBL and VCC. And of course, did the same with ground.
When I tried using resistors and even the transistor, I had problems. But I couldn't get anything to show up at all with the tutorial on the Arduino website for the Epson controller.
Your display is a 3.3 to 5V display which is very nice.
You can just connect it directly to the Arduino - so you are pretty lucky as I can't!
It because it has an 74LCX245 onboard, which is a Voltage Converter...
Ah, I thought I posted that earlier somewhere.
But I also paid $40 after shipping, and I got it within 3 days.
Stupid voltage converters.. :X
Do you know of any code I could take a glance at and figure out how to set up a menu? I tried looking through the Nuelectronics Nokia shields library, but yeah.. no good!
I won't make your projects
But I will help you getting started, and that's what I've done so far...
Now, try on your own - you have a complete library to use :o
Hey guys, I gave this a spin using one of the sparkfun Nokia LCD boards. It sorta works - I'm getting garbled blue and white junk on the lcd. I can make out the text - just.
I'm assuming these are still shipping with the Epson controller.
Who's tried the Sparkfun board - did you hook up the pin 2 to anything?
#define BL 2 // Digital 2 --> BL #define CS 3 // Digital 3 --> #CS #define CLK 4 // Digital 4 --> SCLK #define SDA 5 // Digital 5 --> SDATA #define RESET 6 // Digital 6 --> #RESET
Hmm. Gravitech had some smaple code for the Philips controller. That just gives me blue screen, so I've definitely got Epsons. I have two and they are both doing this.
I've tried it on two different 3.3v Arduinos, re-did my wiring. Same results. I can see that even with the backlight powered off, the same thing is happening, so I don't think it's noise related.
I'm not sure if none of them have the dc-to-dc converter, but the couple people I talked to, didn't include it.
I got mine from Gravitech.us and it came with the voltage booster (dc-to-dc converter), boosting 3.3v or 5v to 7v, which is what is required for the backlight.
So you may have to try out the tutorial from the Arduino website, trying to hook up the power as suggested Arduino Playground - S1D15G10NokiaLCD
But, if you've read through this post completely, you'll see that somebody else tried to hook up all the voltage dividers and whatever else is on that page, and didn't have any luck.
So I'm not 100% sure as far as the sparkfun LCDs go.
But, I did have the same issue, just a black screen, but that was before I hooked up the VBL (power-boosting backlight) and the VCC to the same power supply, then I got the lame gravitech blinking sample!
Also, try a second power supply for the VCC, but BL on the arduino still.
Best of luck.
EDIT: You said you tried the Phillips sample code, but what about the Epson sample code? PS, you can thanks Thomas J for the LCD library for the epson controller, scroll up a bit and download it. Gravitech Electronic Experimental Solutions I just uploaded this, and followed the pin setup from the sketch, didn't work my first time.. I disconnected it, tried again the next day, and worked.. must've missed something when I was connecting it, haven't had any issues since.
The Sparkfun board has the voltage booster for the backlight - it's almost the same setup as the Gravitech one. The fact that there is something getting through to the LCD controller...enough to get some text on there, but the colors and stuff seems all screwed up has got me baffled. I hope there is not some problem with this batch or something.
Ive tried a few different combinations with power supplies, no change.
You've given me hope, I'll pull it all apart and hook it up again from scratch in the morning. Over it for today. >:(
BTW - I'm using teh latest version of the IDE (Arduino-0016) is that what you guys are running?
Unplugging and plugging in the board from the Arduino (or breadboard, from 5v to Arduino in my case), caused funky colors, and even 1 line of LCDs to be.. brighter than the others, but again, the brighter line hasn't showed up and no funky colors!
But I don't unplug it without unplugging the Arduino anymore, had me skurred I ruined a line.
What do you mean by getting messed up colors? Just like, red not showing up as red? etc.
And if you have the voltage booster, no external circuitry should be needed, where do you have your VBL setup? (the voltage booster) Make sure that's in 5v or 3.3v, and make sure the VCC and VBL are on the same voltage, I had issues trying to hook up the VBL on 5v, and VCC on 3.3v.
Sorry if any of this seems really obvious but it's those obvious things that usually get me in the end Just trying to give perspective from my issues.
I'm using 0016 as well. I would contact Sparkfun and give them the heads up.. they're really good at taking care of customers. I've yet to get a bad item from them.
Just tried it with a 5v Arduino, but ran all the data lines through logic level converters to get them down to 3.3v...and the results were..THE SAME. :-[