전체 글 53

네오픽셀 RGB LED / esp8266 / nodemcu / 아두이노

보드 매니저 esp 시리즈 라이브러리 설치 https://dl.espressif.com/dl/package_esp32_index.json http://arduino.esp8266.com/stable/package_esp8266com_index.json github.com/arkhipenko/TaskScheduler Adafruit NeoPixel Library: Adafruit_NeoPixel Class Reference github.com/Links2004/arduinoWebSockets esp8266 소스코드 c:\Users\acer\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\variants\nodemcu\ // pins_ardu..

stm32 아두이노 블루필

1. STLink 로 아두이노 부트로더 적용. github.com/rogerclarkmelbourne/STM32duino-bootloader/tree/master/binaries 패스트 부트로 다시 다운..23.03.12 리셋 누르고 다운시 떼면 다운되기는 함... boot 건들필요 없을듯... BOOT 0을 high로 점퍼 변경후 부트로더 다운로드. 다운 완료후 원위치. 아두이노 2.0버전은 다운 지원 안됨! 기존 1.8.15 버전은 지원안되었는데..아닐수도.. 19는 url 설치.... (23.03.12 추가) url 추가하고 stm32로 검색후 설치 http://dan.drown.org/stm32duino/package_STM32duino_index.json stm32 보드 컴파일러 수동 설치. g..

Firmware/STM32 2020.12.02

날짜, 시간 비교 처리 DateTime.Compare

https://docs.microsoft.com/ko-kr/dotnet/api/system.datetime.compare?view=netcore-3.1 DateTime.Compare(DateTime, DateTime) Method (System) 의 두 인스턴스를 비교하고 첫 번째 인스턴스가 두 번째 인스턴스보다 빠른지, 같은지, 늦은지를 나타내는 정수를 반환합니다.Compares two instances of and returns an integer that indicates whether the first instan docs.microsoft.com 비교에 따라 -1, 0, 1을 리턴하는데 시작시간과 끝내는 시간 처리할 경우, 0과 1일 경우만 동작 처리하면 된다. (-1은 무시) using Sys..

SW/C# 2020.08.11

바이트 byte 버퍼 저장.. 통신 처리에서 사용.

통신 프로토콜 처리시 아스키 문자와 byte 혼합하여 사용할때... String을 byte 로 변환하면 128자 이상부터 깨짐.. 꼼수로 String을 byte 형태로 저장 후 계산 처리할때 실제 byte 로 변환하여 처리함. private string RcvStrData = string.Empty; private void TcpClient_DataRecived(object sender, SimpleTCP.Message e) { string RxString = string.Empty; string strDateLen = DateTime.Now.ToString("[HH:mm:ss:fff (") + Convert.ToString(e.Data.Length) + ")]"; for (int i = 0; i < e..

SW/C# 2020.08.10

문자열16진수를 바이트 형태로 변환 / 특정 문자로 바이트 분리

// 16진수 문자열형태를 16진수 바이트형태로 저장... string str = "4D 42 43 52 47 30 30 36 30 30 39"; byte[] test = str.Split(' ').Select(s => Convert.ToByte(s, 16)).ToArray(); // ======== 바이트 분리 ==================== //MBCR char[] splitId = { 'M', 'B', 'C', 'R' }; List result = new List(); int start = 0; for (int i = 0; i < test.Length; i++) { if ((test[i] == splitId[0] && test[i+1] == splitId[1] && test[i + 2] == ..

SW/C# 2020.08.08

string byte copy 스트링 바이트 복사 Array.Copy 조합, combine

string 문자열과 int 를 byte 배열로 변경....통신에 사용. using System; using System.IO; using System.Text; class MainClass { public static string ByteToString(byte[] strByte, int len) { string str = Encoding.Default.GetString(strByte, 0, len); // 아스키 문자이상은 깨짐...0x128 return str; } public static byte[] StringToByte(string str) { byte[] StrByte = Encoding.UTF8.GetBytes(str); return StrByte; } static string BytesT..

SW/C# 2020.07.27

nRF52 DFU 부트로더 진입

====== SDK 12.3.0 기준 ========= 1) 일반 app 수정 DFU 진입을 원하는 BLE 서비스에서 하기 코드 추가 테스트용으로 귀찮아서 노티 서비스에 추가함. if(p_evt_write->data[0] == 1) { p_our_service->noti_our_enable = true; NRF_LOG_INFO("Notification enabled\r\n"); #define BOOTLOADER_DFU_START 0xB1 NRF_POWER->GPREGRET = BOOTLOADER_DFU_START; NRF_LOG_INFO("bootloder reset!!\r\n"); NVIC_SystemReset(); } else if(p_evt_write->data[0] == 0) { p_our_ser..

BLE/Nordic 2017.06.21