Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SPI.h"
- #include "Adafruit_GFX.h"
- #include "Adafruit_ILI9341.h"
- #define _cs 17 // Goes to TFT CS
- #define _dc 16 // Goes to TFT DC
- #define _mosi 23 // Goes to TFT MOSI
- #define _sclk 18 // Goes to TFT SCK/CLK
- #define _rst 5 // Goes to TFT RESET
- // 3.3V // Goes to TFT LED
- // 5v // Goes to TFT Vcc
- // Gnd // Goes to TFT Gnd
- #define EE_CS 4 // Goes to EEPROM
- #define ee_miso 14 // Goes to EEPROM
- #define ee_mosi 12 // Goes to EEPROM
- #define ee_sclk 13 // Goes to EEPROM
- //Így most SW SPI-vel kezeli a TFT-t igaz lassabb is :(
- Adafruit_ILI9341 tft = Adafruit_ILI9341(_cs, _dc, _mosi, _sclk, _rst);
- void setup() {
- Serial.begin(115200);
- tft.begin();
- tft.setRotation(4);
- tft.fillScreen(ILI9341_BLACK);
- tft.setTextSize(3);
- tft.setTextColor(ILI9341_WHITE, ILI9341_BLACK);
- tft.println("Starting... ");
- pinMode(EE_CS,OUTPUT); //eeprom CS lábat kimenetre állítani
- digitalWrite(EE_CS, HIGH); //eeprom CS lábat felhúzni
- SPI.begin(ee_sclk, ee_miso, ee_mosi); // eeprom lábak megadása
- digitalWrite(EE_CS, LOW); // eeprom inicializálása
- SPI.transfer(1);
- SPI.transfer(0);
- digitalWrite(EE_CS, HIGH);
- for(unsigned int j=0; j< 255; )
- {
- digitalWrite(EE_CS, LOW);
- SPI.transfer(6); // írás engedélyezése 6
- digitalWrite(EE_CS, HIGH);
- digitalWrite(EE_CS, LOW);
- SPI.transfer(2); // write 2,0
- SPI.transfer(j >>8); //a cím felső 8 bit-je
- SPI.transfer(j & 0x00FF); //a cím alsó 8 bit-je
- SPI.transfer(j); //a kívánt adat beírása az eepromba
- digitalWrite(EE_CS, HIGH);
- tft.setCursor(1, 1);
- tft.println(j);
- j++;
- digitalWrite(EE_CS, LOW);
- SPI.transfer(4); //az írás lezárása
- digitalWrite(EE_CS, HIGH);
- }
- tft.setCursor(1, 1);
- tft.println("Kesz! ");
- }
- void loop(void) {
- }
Add Comment
Please, Sign In to add comment