Arduino Uno i oled 128x64 - Wersja do druku +- Arduino Polska Forum (https://forum.arduinopolska.pl) +-- Dział: Korzystanie z Arduino (https://forum.arduinopolska.pl/dzial-korzystanie-z-arduino) +--- Dział: Instalacja i rozwiązywanie problemów (https://forum.arduinopolska.pl/dzial-instalacja-i-rozwi%C4%85zywanie-problem%C3%B3w) +--- Wątek: Arduino Uno i oled 128x64 (/watek-arduino-uno-i-oled-128x64) Strony:
1
2
|
Arduino Uno i oled 128x64 - juriii28 - 14-11-2016 Witam Panowie. Mam taki problem. Chce sobie zrobić wiatromierz na arduino. Kupiłem już arduino uno, wyświetlacz oled 128x64 i2c, oraz anemometr na dach. Ostrzegam iż jestem całkowitym laikiem... Problem polega na tym iż po wgraniu już samych bibliotek: https://github.com/adafruit/Adafruit_SSD1306 https://github.com/adafruit/Adafruit-GFX-Library ,i po uruchomieniu przykładu z adafruit SSD 1306 (ssd1306_128x64_i2c) wyskakuje błąd kompilacji. Jest troche lepiej jak z tego menu wybiore (ssd1306_128x32_i2c), wtedy odpal sie to "demo" ale obraz jest jakby obcięty. Problem też jest po wgraniu programu do arduino z tego filmu https://www.youtube.com/watch?v=slzOhgBeQjc. Po załączeniu napięcia na wyświetlaczu pojawia sie śnieg, a gdy dotkne palcem pinu 8 to pojawia sie na wyświetlaczu tylko napis Wind speed Prosze o pomoc. Bo już nie wiem co dalej... RE: Arduino Uno i oled 128x64 - adix - 15-11-2016 A wielkość lcd masz dobrze zdefiniowana. RE: Arduino Uno i oled 128x64 - juriii28 - 15-11-2016 A jak to sprawdzić, ewentualnie poprawić? Panowie gdy wgram biblioteki do tego wyświetlacza i próbuje wgrać przykładowy progrma to wyskakuje coś takiego. Co robie żle? Arduino:1.6.12 (Windows 8.1), Płytka:"Arduino/Genuino Uno" ssd1306_128x64_i2c:54: error: #error ("Height incorrect, please fix Adafruit_SSD1306.h!"); #error("Height incorrect, please fix Adafruit_SSD1306.h!"); ^exit status 1 #error ("Height incorrect, please fix Adafruit_SSD1306.h!"); Próbowałem już różne wersje, i na każdej jest to samo. RE: Arduino Uno i oled 128x64 - juriii28 - 16-11-2016 Podpowie ktoś jak rozwiązać problem? RE: Arduino Uno i oled 128x64 - Automatyk - 16-11-2016 Jak wygląda twój kod ? RE: Arduino Uno i oled 128x64 - juriii28 - 17-11-2016 Ok. To powiedzmy że z przykładów wybieram Adafruit_ssd1306_128x64_i2c. Kod: #include <SPI.h> I taki błąd wyskakuje: Arduino:1.7.10 (Windows 8.1), Płyta:"Arduino Uno" ssd1306_128x64_i2c.ino:54:2: error: #error ("Height incorrect, please fix Adafruit_SSD1306.h!"); Błąd kompilacji. Raport ten będzie miał więcej informacji z "Pokaż szczegółowe informacje podczas kompilacji" włącz w Plik > Preferencje RE: Arduino Uno i oled 128x64 - Automatyk - 17-11-2016 Masz pozostale biblioteki potrzebne do kompilacji? RE: Arduino Uno i oled 128x64 - juriii28 - 17-11-2016 Witam. Biblioteki Spi orazWire także są zainstalowane w programie arduino, można je wybrać z biblioteki. ja tylko pobrałem te dwie biblioteki adefruit do obsługi wyświetlacza. A tu ten błąd ze szczegółami: Arduino:1.7.10 (Windows 8.1), Płyta:"Arduino Uno" Użycie biblioteki SPI z folderu C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI Użycie biblioteki Wire z folderu C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire Użycie biblioteki Adafruit GFX Library z folderu C:\Users\HP\Documents\Arduino\libraries\Adafruit_GFX Użycie biblioteki Adafruit SSD1306 z folderu C:\Users\HP\Documents\Arduino\libraries\Adafruit_SSD1306 C:\Program Files (x86)\Arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=107010 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SPI -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Users\HP\Documents\Arduino\libraries\Adafruit_GFX -IC:\Users\HP\Documents\Arduino\libraries\Adafruit_SSD1306 C:\Users\HP\AppData\Local\Temp\build2480589770584151020.tmp\ssd1306_128x64_i2c.cpp -o C:\Users\HP\AppData\Local\Temp\build2480589770584151020.tmp\ssd1306_128x64_i2c.cpp.o ssd1306_128x64_i2c.ino:54:2: error: #error ("Height incorrect, please fix Adafruit_SSD1306.h!"); Błąd kompilacji. RE: Arduino Uno i oled 128x64 - namok - 17-11-2016 ssd1306_128x64_i2c.ino:54:2: error: #error ("Height incorrect, please fix Adafruit_SSD1306.h!"); A zajrzałeś do tego pliku(Adafruit_SSD1306.h) i zmieniłeś definicję - wiersz 70? RE: Arduino Uno i oled 128x64 - juriii28 - 17-11-2016 Nie , nie zaglądałem. Rozumiem że można go otworzyć w WordPad? Wiersz 70? ciężko to policzyć. Czego mam szukać? /********************************************************************* This is a library for our Monochrome OLEDs based on SSD1306 drivers Pick one up today in the adafruit shop! ------> http://www.adafruit.com/category/63_98 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution *********************************************************************/ #ifndef _Adafruit_SSD1306_H_ #define _Adafruit_SSD1306_H_ #if ARDUINO >= 100 #include "Arduino.h" #define WIRE_WRITE Wire.write #else #include "WProgram.h" #define WIRE_WRITE Wire.send #endif #if defined(__SAM3X8E__) typedef volatile RwReg PortReg; typedef uint32_t PortMask; #define HAVE_PORTREG #elif defined(ARDUINO_ARCH_SAMD) // not supported #elif defined(ESP8266) || defined(ESP32) || defined(ARDUINO_STM32_FEATHER) || defined(__arc__) typedef volatile uint32_t PortReg; typedef uint32_t PortMask; #else typedef volatile uint8_t PortReg; typedef uint8_t PortMask; #define HAVE_PORTREG #endif #include <SPI.h> #include <Adafruit_GFX.h> #define BLACK 0 #define WHITE 1 #define INVERSE 2 #define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D // Address for 128x32 is 0x3C // Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded) /*========================================================================= SSD1306 Displays ----------------------------------------------------------------------- The driver is used in multiple displays (128x64, 128x32, etc.). Select the appropriate display below to create an appropriately sized framebuffer, etc. SSD1306_128_64 128x64 pixel display SSD1306_128_32 128x32 pixel display SSD1306_96_16 -----------------------------------------------------------------------*/ // #define SSD1306_128_64 #define SSD1306_128_32 // #define SSD1306_96_16 /*=========================================================================*/ #if defined SSD1306_128_64 && defined SSD1306_128_32 #error "Only one SSD1306 display can be specified at once in SSD1306.h" #endif #if !defined SSD1306_128_64 && !defined SSD1306_128_32 && !defined SSD1306_96_16 #error "At least one SSD1306 display must be specified in SSD1306.h" #endif #if defined SSD1306_128_64 #define SSD1306_LCDWIDTH 128 #define SSD1306_LCDHEIGHT 64 #endif #if defined SSD1306_128_32 #define SSD1306_LCDWIDTH 128 #define SSD1306_LCDHEIGHT 32 #endif #if defined SSD1306_96_16 #define SSD1306_LCDWIDTH 96 #define SSD1306_LCDHEIGHT 16 #endif #define SSD1306_SETCONTRAST 0x81 #define SSD1306_DISPLAYALLON_RESUME 0xA4 #define SSD1306_DISPLAYALLON 0xA5 #define SSD1306_NORMALDISPLAY 0xA6 #define SSD1306_INVERTDISPLAY 0xA7 #define SSD1306_DISPLAYOFF 0xAE #define SSD1306_DISPLAYON 0xAF #define SSD1306_SETDISPLAYOFFSET 0xD3 #define SSD1306_SETCOMPINS 0xDA #define SSD1306_SETVCOMDETECT 0xDB #define SSD1306_SETDISPLAYCLOCKDIV 0xD5 #define SSD1306_SETPRECHARGE 0xD9 #define SSD1306_SETMULTIPLEX 0xA8 #define SSD1306_SETLOWCOLUMN 0x00 #define SSD1306_SETHIGHCOLUMN 0x10 #define SSD1306_SETSTARTLINE 0x40 #define SSD1306_MEMORYMODE 0x20 #define SSD1306_COLUMNADDR 0x21 #define SSD1306_PAGEADDR 0x22 #define SSD1306_COMSCANINC 0xC0 #define SSD1306_COMSCANDEC 0xC8 #define SSD1306_SEGREMAP 0xA0 #define SSD1306_CHARGEPUMP 0x8D #define SSD1306_EXTERNALVCC 0x1 #define SSD1306_SWITCHCAPVCC 0x2 // Scrolling #defines #define SSD1306_ACTIVATE_SCROLL 0x2F #define SSD1306_DEACTIVATE_SCROLL 0x2E #define SSD1306_SET_VERTICAL_SCROLL_AREA 0xA3 #define SSD1306_RIGHT_HORIZONTAL_SCROLL 0x26 #define SSD1306_LEFT_HORIZONTAL_SCROLL 0x27 #define SSD1306_VERTICAL_AND_RIGHT_HORIZONTAL_SCROLL 0x29 #define SSD1306_VERTICAL_AND_LEFT_HORIZONTAL_SCROLL 0x2A class Adafruit_SSD1306 : public Adafruit_GFX { public: Adafruit_SSD1306(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS); Adafruit_SSD1306(int8_t DC, int8_t RST, int8_t CS); Adafruit_SSD1306(int8_t RST = -1); void begin(uint8_t switchvcc = SSD1306_SWITCHCAPVCC, uint8_t i2caddr = SSD1306_I2C_ADDRESS, bool reset=true); void ssd1306_command(uint8_t c); void clearDisplay(void); void invertDisplay(uint8_t i); void display(); void startscrollright(uint8_t start, uint8_t stop); void startscrollleft(uint8_t start, uint8_t stop); void startscrolldiagright(uint8_t start, uint8_t stop); void startscrolldiagleft(uint8_t start, uint8_t stop); void stopscroll(void); void dim(boolean dim); void drawPixel(int16_t x, int16_t y, uint16_t color); virtual void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color); virtual void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color); private: int8_t _i2caddr, _vccstate, sid, sclk, dc, rst, cs; void fastSPIwrite(uint8_t c); boolean hwSPI; #ifdef HAVE_PORTREG PortReg *mosiport, *clkport, *csport, *dcport; PortMask mosipinmask, clkpinmask, cspinmask, dcpinmask; #endif inline void drawFastVLineInternal(int16_t x, int16_t y, int16_t h, uint16_t color) __attribute__((always_inline)); inline void drawFastHLineInternal(int16_t x, int16_t y, int16_t w, uint16_t color) __attribute__((always_inline)); }; #endif /* _Adafruit_SSD1306_H_ */ |