no image
아두이노 DAC, PWM
Digital-to-Analog Converter (DAC) 아두이노는 DAC기능이 없어 연속적인 아날로그 값을 만들 순 없지만 PWM을 이용해 비슷한 기능을 할 수 있다. (UNO R4는 있는 듯) Pulse Width Modulation (PWM) LED 밝기 조절을 예시로 살펴보자. 어떻게 전압의 펄스 폭 조절이 밝기에 변화를 줄 수 있을까? => 펄스의 주기는 매우 빠르기 때문에 사람 눈으로 본다면 펄스 폭이 50%인 것은 밝기가 50%인 것과 같게 보인다. 아두이노의 AnalogWriteMega.ino example을 실행시켜보자. const int lowestPin = 4; const int highestPin = 6; void setup() { // set pins 2 through 13 a..
2024.02.18
no image
I2C Communication
Inter-Integrated circuit communication I, 2개를 따서 I2C 통신이라 부른다. 일대다 통신이 가능하다. 하나의 Master node와 여러 개의 Slave node 가 있다. Two-pin protocol SDA (Serial data): data transmission SCL (Seerial clock): clock transmission = 동기를 맞추는 역할을 한다. 위의 2개의 핀으로 통신한다. Timing diagram Free state - SCL과 SDA 둘 다 HIGH인 상태로 시작한다. Start condition - SDA가 LOW가 되면 Slave node 들은 데이터를 수신할 준비가 된다. I2C는 일대다 통신으로 Master가 통신할 slave n..
2024.02.17
no image
릿코드 2. Add Two Numbers, 49. Group Anagrams
문제 2. https://leetcode.com/problems/add-two-numbers/description/?envType=study-plan-v2&envId=top-interview-150 LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 접근 문제에서 제시한 singly-linked list 구조에 맞춰 알고리즘을 풀어나가는 문제였다. 처음에 순서를 ..
2024.02.17
no image
릿코드 134. Gas Station, 135. Candy
문제 134. https://leetcode.com/problems/gas-station/description/?envType=study-plan-v2&envId=top-interview-150 LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 135. https://leetcode.com/problems/candy/description/?envType=stud..
2024.02.09
no image
충만하게 살자, 공허의 시대(조남호)
요즘 느끼는 감정과 생각을 말하는 강연을 봤다. 졸업 후 취업을 준비하고, 취업하고 퇴사, 다시 취업을 준비하면서 감정과 생각이 많이 널뛰었고, 계속 변했다. 공허함, 외로움을 느낄 때도 많았고, 사람이 살아야 하는 동기가 뭘까를 생각하기도 했다. 최근에는 일론 머스크의 인터뷰 영상을 많이 봤다. 그중 한 영상에는 다음과 같은 말이 나온다. "세상에는 해결해야 할 문제가 차고 넘치지만, 삶의 목표가 문제들을 해결하는 것일 수는 없다." "삶의 유일한 목적이 문제 해결일 수는 없다. 우리의 인생에는 영감을 주는 일이 필요하다. 아침에 눈을 뜨고 싶은 이유가 되는 무언가가" 요즘은 내가 정말 하고 싶은 것은 무엇인지를 많이 의식하려 한다. 나는 의식하고 무엇을 좋아하는 편은 아니어서 그걸 좋아하는 건지, 왜..
2024.02.06
no image
릿코드 238. Product of Array Except Self
문제 https://leetcode.com/problems/product-of-array-except-self/description/?envType=study-plan-v2&envId=top-interview-150 LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 접근 나누기를 하지 않고 O(n) 연산을 하라는 것에 아이디어가 안떠올랐다. Discussion ..
2024.02.06
no image
릿코드 45. Jump Game II
문제 링크 https://leetcode.com/problems/jump-game-ii/description/?envType=study-plan-v2&envId=top-interview-150 LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 접근 $ \bullet $ 마지막 인덱스에 도달할 수 없는 case는 없다. $ \bullet $ 그래서, (마지막 인덱..
2024.02.04
no image
릿코드 55. Jump Game
문제 https://leetcode.com/problems/jump-game/description/?source=submission-noac LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 접근 DP를 생각했다. $ A_{n} $까지 점프할 수 있는 $ A_{n-1}, A_{n-4}, A_{n-7} .... $ 이 있다면 $ A_{n-1} $까지 점프할 수 있..
2024.02.02
no image
릿코드 121. Best Time to Buy and Sell Stock
문제 https://leetcode.com/problems/best-time-to-buy-and-sell-stock/description/?envType=study-plan-v2&envId=top-interview-150 LeetCode - The World's Leading Online Programming Learning Platform Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 저점(buy), 고점(sell)을 변수로 두고 생각했는데 O(n^2) 밖에 안떠올랐고 Dis..
2024.02.01