1 / 18

Integrating an ATtiny85 and an OLED

Integrating an ATtiny85 and an OLED. TYWu. Library. ssd1306xled. OLED2864. Resolution. 128. 64. SSD1306.ssd1306_char_f8x16. SSD1306.ssd1306_char_f8x16(x, y, string) Font Size: 8x16 (Home Version is modified by TY Wu for the size 16x16) x: 0~128 y:0 (0*8), 1 (1*8), 2 (2*8).

ecombs
Download Presentation

Integrating an ATtiny85 and an OLED

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integrating an ATtiny85 and an OLED TYWu

  2. Library • ssd1306xled

  3. OLED2864 • Resolution 128 64

  4. SSD1306.ssd1306_char_f8x16 • SSD1306.ssd1306_char_f8x16(x, y, string) • Font Size: 8x16 (Home Version is modified by TY Wu for the size 16x16) • x: 0~128 • y:0 (0*8), 1 (1*8), 2 (2*8) SSD1306.ssd1306_char_f8x16(0, 5, “Q”) 5*8=40 Q

  5. Connection • 2. Connect VDD to 3.3V • 3. Connect GND • 4. (OLED) RES <-> PB1, Give a pulse 1->0->1 (ATTINY85) (pin 6) • 5. (OLED) CS <-> GND • 6. (OLED) SDA <-> PB0 (ATTINY85) (pin 5) • 7. (OLED) SCL <-> PB2 (ATTINY85) (pin 7) • 8. D/C: Floating Small OLED

  6. Connection

  7. Replace ld.exe • This patch replaces the ld.exe file (or just ld for Mac) in WinAVR/Crosspack supplied with the Arduino IDE. The supplied version has a bug which causes weird errors when files larger than 4kB are compiled for AVR25 processors which include those in the Tiny series.

  8. Replace ld.exe • Download and replace ld.exe • URL • https://github.com/TCWORLD/ATTinyCore/tree/master/PCREL%20Patch%20for%20GCC • Relace • ?\arduino-1.0.4\hardware\tools\avr\avr\bin\ld.exe

  9. Example #include <font8x16.h> #include <ssd1306xled.h> #include <ssd1306xled8x16.h>

  10. Example void setup() { pinMode(PB4, OUTPUT); //BEEP pinMode(3, INPUT); //Button digitalWrite(3, HIGH); //Pull-up OLED_reset(); SSD1306.ssd1306_init(); clear_OLED();

  11. Example SSD1306.ssd1306_char_f8x16(0, 5, "By TY Wu"); for(int j=0;j<64;j++) { SSD1306.ssd1306_char_f8x16(j, 0, "NCUE"); for(int k=128;k>j*2;k--) { digitalWrite (PB4,HIGH); delayMicroseconds (j+1); digitalWrite (PB4,LOW); delayMicroseconds (j+1); } }

  12. Example delay(500); for(int j=64;j>0;j--) { SSD1306.ssd1306_char_f8x16(j, 0, "NCUE"); for(int k=128;k>j*2;k--) { digitalWrite (PB4,HIGH); delayMicroseconds (j+1); digitalWrite (PB4,LOW); delayMicroseconds (j+1); } } delay(1000); }

  13. Example void OLED_reset() { delay(300); pinMode(1, OUTPUT); //Connect to RES (RESET) digitalWrite(1, HIGH); delay(300); digitalWrite(1, LOW); delay(1000); digitalWrite(1, HIGH); }

  14. Example int s=0; int m=0; int h=0; void loop() { char time_str[12]; s=(s+1)%60; if(s==0) { m=(m+1)%60; if(m==0) h=(h+1)%24; } sprintf(time_str, "%02d:%02d:%02d", h, m, s); SSD1306.ssd1306_char_f8x16(0, 0, time_str); //x, y }

  15. Connection (Partial)

  16. Other OLED Compatible pins SDA SCK VDD VSS

  17. Exercise

  18. Reference • http://webboggles.com/attiny85-breakout-keychain-game/

More Related