본문 바로가기

SET_DRAW 명령어

Result

 

 

Example

 void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial2.begin(115200,SERIAL_8N1, 18, 19);
  // put your main code here, to run repeatedly:

  char sendData[SIZE_SET_DRAW_FIELD] = {0};
  int idx= 0;
  uint8_t cmd;
  uint8_t red, green, blue;
  short dotLen = 1;
  uint8_t pageNum = 1;
  uint8_t pointX = 10;
  uint8_t pointY = 10;
  int colorValue = 0x001f0000;

  short  effectBorderTime  = 0x00;  //  Effect Border Blink 주기 
  int effectBorderColor  = 0;             //  Effect Border RGB 색상 
  uint8_t effectColorSpeed= 0x00;  // Effect Color effect 주기
  short  effectStarRainTime= 0x00;   // Effect  Star 속도 

  int sendBufLen = SIZE_PAGE + SIZE_SET_DRAW_FIELD + SIZE_TEXT_LEN + SIZE_FONT_SIZE + SIZE_FONT_COLOR + SIZE_BG_COLOR + SIZE_ACTION_CMD + SIZE_ACTION_TIME + SIZE_EFFECT_PACKET;
  char * sendBuf;
  sendBuf = (char *) malloc(sendBufLen);

  red = (byte)(((colorValue & 0x00ff0000) >> 16) / 8);
  green = (byte)(((colorValue & 0x0000ff00) >> 8) / 8);
  blue = (byte)(((colorValue & 0x000000ff) >> 0) / 8);

  sendBuf[idx++] = pageNum;                       
  sendBuf[idx++] = (uint8_t)(dotLen >> 8);
  sendBuf[idx++] = (uint8_t)dotLen;
  sendBuf[idx++] = pointX;
  sendBuf[idx++] = pointY;       
  sendBuf[idx++] = red;       
  sendBuf[idx++] = green;       
  sendBuf[idx++] = blue;       

 
  sendBuf[idx++] = (effectCmd& 0x000000ff); 
  sendBuf[idx++] = (effectBorderTime & 0x0000ff00 >> 8); 
  sendBuf[idx++] = (effectBorderTime & 0x000000ff); 
  sendBuf[idx++] = (effectBorderColor & 0x00ff0000) >> 16) / 8);
  sendBuf[idx++] = (effectBorderColor & 0x0000ff00) >> 8) / 8);
  sendBuf[idx++] = (effectBorderColor & 0x000000ff) >> 0) / 8);
  sendBuf[idx++] = effectColorSpeed; 
  sendBuf[idx++] = effectStarRainTime & 0x0000ff00 >> 8); 
  sendBuf[idx++] = effectStarRainTime & 0x000000ff); 
 
  cmd = (uint8_t)SET_DRAW;
  transmit_data(cmd, (char*)sendBuf, sendBufLen);
  free(sendBuf);
}

Code Download