ttgo esp32 보드를 sloeber 에서 돌렸다.

 

기존에 esp32 sloeber 에서 설정한 내용이 있다. 참고 해야 한다.

 

http://bigwavek.tistory.com/entry/Esp32-%ED%99%98%EA%B2%BD-Sloeber-Eclipse-Arduino-%EC%98%B4%EA%B8%B0%EA%B8%B0?category=742263

 

1. 환경 구축 1

 Arduino > Preferences 에서 라이브러리를 다운받아야 한다.

 

 

 

 

Adafrult GFX Library , Adafrult SSD1306 을 설치 한다.

 

2. 환경구축 2

 Arduino > Add Select the Arduino libraries 에 해당 라이브러리를 사용하도록 선택 한다.

 주의) Project Explorer 창에서 메뉴에 진입 해야 한다.

 

 

 

3. 소스 입력

#include "Arduino.h"

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

//The setup function is called once at startup of the sketch

//Pin map define
//SDA = pin 4, SCL = pin 15, RESET = pin 16

//internal led is on pin 2

#define OLED_RESET 16
#define LED 2

 

//Graphic define
#define NUMFLAKES 10
#define XPOS 0
#define YPOS 1
#define DELTAY 2

#define LOGO16_GLCD_HEIGHT 16
#define LOGO16_GLCD_WIDTH  16

static const unsigned char PROGMEM logo16_glcd_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };


Adafruit_SSD1306 display(OLED_RESET);

 

void setup()
{
 // Add your initialization code here
 pinMode(LED, OUTPUT);

 Serial.begin(115200);
 delay(10);

 

 // initialize with the I2C addr 0x3D (for the 128x64)
 // initialize with the I2C addr 0x3C (for the 128x32)
 display.begin(SSD1306_SWITCHCAPVCC, 0x3C);


 display.display();  //diplay output
 delay(2000);
 display.clearDisplay(); // Clear the buffer.

 //drawPixel
 display.drawPixel(10, 10, WHITE);
 display.display();  //diplay output
 delay(2000);
 //display.clearDisplay(); // Clear the buffer.

 Serial.println("Start..");

}

 

// The loop function is called in an endless loop
void loop()
{
 //Add your repeated code here
 digitalWrite(LED, 1);
 delay(1000);
 Serial.println("LED OFF");

 digitalWrite(LED, 0);
 delay(1000);
 Serial.println("LED ON");
}

 

위와 같이 수정해서 입력 했다.

주의 사항은 OLDE 가 128x32 의 해상도이기 때문에

display.begin(SSD1306_SWITCHCAPVCC, 0x3C) 로 선언해야한다.

 

 

 

4. pins_arduino.h 수정

ttgo 보드가 기본 pin map을 따르지 않기 때문에 pin map 을 수정해야 하는데 이 부분을

기존 아두이노 스케치면 수정하기가 어려웠을것 같다.

 

아래와 같이 수정했다.

 

//TTGO
static const uint8_t SDA = 4;
static const uint8_t SCL = 15;

//orignal
//static const uint8_t SDA = 21;
//static const uint8_t SCL = 22;

 

 

5. 다운로드

sloeber  가 기존 아두이노 스케치와 다른 부분이 스케치에서는 Upload 를 누르면 컴파일과정을 한후

진행이 되는데 sloeber 는 컴파일을 하지 않는다. 꼭 수정후 Verify 과정을 진행해 컴파일을 해야한다.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

'공부 > arduino' 카테고리의 다른 글

esp32 아두이노 라이브러리 업그레이드  (0) 2018.04.12
esp32 spi OLED 돌리기  (0) 2018.04.09
esp32 ttgo 보드  (0) 2018.04.06
Esp32 환경 Sloeber Eclipse Arduino 옴기기  (0) 2018.04.05
arduino Eclipse 에서 사용하기  (0) 2018.04.05

+ Recent posts