Pages: 1 ... 8 9 [10] 11 12 ... 15   Go Down
Author Topic: U8glib: Graphics Lib for LCDs and OLEDs  (Read 43918 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you Oliver for your care

and i am so sorry for my poring asking smiley-cry



this is the code i use and there is some pictures in attachments

Code:

#include "U8glib.h"



U8GLIB_KS0108_128 u8g(36, 40, 42, 44, 46, 48, 50, 52, 34, 22, 24, 28, 30 );


void draw(void) {
 
  u8g.setFont(u8g_font_unifont);
  u8g.setPrintPos(0, 20);
 
  u8g.print("Hello World!");
}

void setup(void) {
 
   u8g.setRot180();
 
}

void loop(void) {
 
 
  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
 
 
  delay(2000);
}


* picture 1.jpg (3349.85 KB, 2560x1920 - viewed 37 times.)
Logged

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

and that is the second picture

and thank you Oliver  smiley-kiss


* picture 2.jpg (2983.88 KB, 2560x1920 - viewed 44 times.)
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the pictures. Still it is difficult to follow the wires. In general, i think the wires are too long.
Another question: What happens if you change the variable pot. Can you see the pixels at the most left or most right position?

Oliver
Logged

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

 Hi Oliver

yes i see some pixels but it about to disappear

i almost seeing these pixels

and i cant see it from a distance i can see it hardly when i am close enough to the lcd

and when i change the variable pot there is nothing happened ,the pixels not going lighter and not even being darker .

shall i change the variable pot?   smiley-roll-sweat

and thank you Oliver  you really a good person  smiley-kiss   
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

With the variable pot it should be possible to turn off and on all pixels. So probably something is miswired with your variable pot.

Oliver
Logged

Toulouse, France
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hallo Oliver,

Thanks a lot for U8glib, it's great when RAM is limited. Thanks to that, I've been able to use an ATtiny85 w/ Arduino core to control an OLED display.

FYI, I had to remove all *_hw_spi.c files from the library because some symbols were undefined at compile time (for instance SPDR). It seems logical because ATtiny85s don't have any direct hardware API support. Do you believe there is a way to exclude those files automatically? Maybe with the right #ifdef...

If that can help anyone else, here's what I had to do to get everything working (in addition to configuring an Arduino as ATtiny programmer):
  • set the ATtiny internal clock to 8 MHz
  • (OS X) install the latest CrossPack-AVR and replace /Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/avr/bin/ld with /usr/local/CrossPack-AVR/avr/bin/ld (solves code relocation issues at the link stage)
  • remove all U8glib/utility/*_hw_spi.c files
  • use a small font because the 8 kB flash is easily exhausted
  • of course, use the lib constructor for software SPI

The next thing I would like to do is to use the USI provided by the ATtiny in order to implement hardware SPI, with the hope that it will both improve performance and reduce program size (currently, just creating the library instance takes 4 kB). I saw that there is some ATtiny support in the library, though not in Arduino context. Does it use USI or just software SPI? If hardware SPI is implemented, can you give me a few hints that would help me make the port from AVR to Arduino? I can then submit a patch.

Thanks again for your lib.
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Atvaark

As far as i remember there is no HW support for the ATTiny. I would be glad to add support for ATTiny to U8glib, but i need to be able to compile for the ATTiny to check and test the modifications for ATTiny. Is there some extension for the Arduino IDE so that ATTiny appears as a board?

Oliver
Logged

Toulouse, France
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I followed the instructions there and it works like a charm:
http://hlt.media.mit.edu/?p=1695

The Arduino IDE + core can be used to program the ATtiny using an Arduino as programmer.
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Somehow the link does not work :-(

Oliver
Logged

Toulouse, France
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Strange… It did yesterday!

I hope I remember all the steps:
1. Download the ATtiny Arduino core at https://github.com/damellis/attiny
2. Create a 'hardware' directory in the Arduino directory (the one in the preferences of the Arduino IDE)
3. Copy the downloaded attiny directory (the one that contains boards.txt) to the new hardware directory
4. Relaunch the Arduino IDE, you should now see ATtiny items in the Tools > Boards menu
5. Open the ArduinoISP sketch from File > Examples
6. Upload the sketch to the Arduino (must be ATMega328-based!)
7. Connect the ATtiny to the Arduino : Arduino pin 10 --> ATtiny pin 1, 11 --> 5, 12 --> 6 and 13 --> 7
8. Add a 10 µF capacitor between the Arduino reset pin and ground (prevents the Arduino from resetting when uploading a sketch to the ATtiny)
9. In the Arduino IDE, choose your ATtiny chip from Tools > Board
10. In the Arduino IDE, choose 'Arduino as ISP' from Tools > Programmer
11. You can now upload a sketch directly from the IDE to the ATtiny

To set the ATTiny internal clock to 8 MHz (necessary for software SPI) :
1. Choose the 8 MHz variant from Tools > Board
2. Tools > Burn Bootloader (this won't actually burn any bootloader, just set internal ATtiny flags)

I hope I didn't forget anything.  smiley-roll-sweat
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I have fixed  the errors for ATTiny in the repository (snapshot attached). Thanks for pointing out this problem.
Currently there is no HW SPI support for ATTiny.  smiley-sad

Oliver

* u8glib_arduino_v1.14pre1.zip (1033.76 KB - downloaded 15 times.)
Logged

Toulouse, France
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Oliver,

Thanks for fixing the compilation issue!

Once I have understood the design of the U8glib abstraction layer, I'll try to implement hw SPI using the code posted by Nick on this thread:
http://forum.arduino.cc/index.php?topic=152432.0
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You can use this file as a template:
https://code.google.com/p/u8glib/source/browse/csrc/u8g_com_arduino_std_sw_spi.c

Oliver
Logged

Toulouse, France
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Oliver,

I managed to add support for Arduino ATtiny85 hardware SPI. I tested it with an SSD1306 OLED controller (Adafruit 128x32) and it seems to be working OK. As predicted, it spares some CPU time and program memory.

The mod is attached. Feel free to include it into future releases, as is or modified.

Part of the credit goes to Nick Gammon, thanks to the code he posted there: http://forum.arduino.cc/index.php?topic=152432.0

Danke schön for your library.  smiley

* ATtiny85_hw_spi_mod.zip (16.1 KB - downloaded 30 times.)
Logged

Germany
Offline Offline
Edison Member
*
Karma: 133
Posts: 1447
If you believe something is right, you won't see what's wrong (David Straker).
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks. I have updated issue 190 to add your patch as part of the support for attiny.

Oliver
Logged

Pages: 1 ... 8 9 [10] 11 12 ... 15   Go Up
Jump to: