1시간 30분 걸린듯
그 와중에 회사 지하주차장 2중 주차도 만석이라
대환장의 카오스
'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글
| 버닝 (0) | 2025.10.17 |
|---|---|
| 난 진급할 수 있을까? (0) | 2025.10.14 |
| 내일은 월요일 (0) | 2025.10.12 |
| 10월의 시작 (0) | 2025.10.01 |
| 멘탈 크래시 크래시 (0) | 2025.09.18 |
1시간 30분 걸린듯
그 와중에 회사 지하주차장 2중 주차도 만석이라
대환장의 카오스
| 버닝 (0) | 2025.10.17 |
|---|---|
| 난 진급할 수 있을까? (0) | 2025.10.14 |
| 내일은 월요일 (0) | 2025.10.12 |
| 10월의 시작 (0) | 2025.10.01 |
| 멘탈 크래시 크래시 (0) | 2025.09.18 |
어우.. 직장인이 가장 싫어하는 요일(!)
거의 10일 만에 출근하려니 겁.나.싫.다!
| 난 진급할 수 있을까? (0) | 2025.10.14 |
|---|---|
| 비 그리고 차 (0) | 2025.10.13 |
| 10월의 시작 (0) | 2025.10.01 |
| 멘탈 크래시 크래시 (0) | 2025.09.18 |
| 복리 / 단리 (0) | 2025.09.17 |
LM7805와 같은 리니어 레귤레이터 말고 스위칭 레귤레이터를 찾았었는데
이 기회에 써봐야 할 듯.
LM2576
[링크 : https://jerry-rc.tistory.com/31]
LM2596
[링크 : https://itempage3.auction.co.kr/DetailView.aspx?itemno=E610667444]
LM317
[링크 : https://itempage3.auction.co.kr/DetailView.aspx?itemno=C441108509]
| 로터리 엔코더 (0) | 2025.10.22 |
|---|---|
| 스위칭 파워(스텝다운 컨버터) MP1584 사용 (0) | 2025.10.18 |
| 아 어쩐지 부품이 두개더라 -_-? (0) | 2025.10.08 |
| 1.8인치 TFT SPI 128x160 (0) | 2025.10.07 |
| 열전대 써모커플러 (0) | 2025.07.17 |
| LD_DEBUG=libs (0) | 2025.06.02 |
|---|---|
| linux device tree(dtb) 문법...? (0) | 2024.12.04 |
| usb hid, hidraw (0) | 2024.03.11 |
| linux 멀티터치 프로토콜 (0) | 2024.03.08 |
| btrfs CoW (0) | 2024.02.15 |
아두이노 나노 v3.0 이고, 아래의 셋팅으로 진행함

라이브러리 매니저에서 servo / arduino 를 설치하고

귀찮으니 D5/D6/D9/D10 옮겨가며 해보는걸로 하고, 일단은 날로 먹기 모드 ㅋㅋ

아래 코드를 대충 작성해서 넣어주면
#include <Servo.h>
Servo myservo[4];
String inputString = "";
bool stringComplete = false;
unsigned char pwm_ch[4] = {5,6,9,10};
unsigned char pwm_val[4] = {127,127,127,127};
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello");
inputString.reserve(200);
for(int idx = 0;idx < 4;idx++)
{
myservo[idx].attach(pwm_ch[idx]);
myservo[idx].write(pwm_val[idx]);
}
}
void loop() {
// put your main code here, to run repeatedly:
if (stringComplete) {
char data[64] = "";
inputString.toCharArray(data, inputString.length());
sscanf(data, "%d,%d,%d,%d\n",
&(pwm_val[0]),
&(pwm_val[1]),
&(pwm_val[2]),
&(pwm_val[3]));
char res[64] = "";
sprintf(res, "get %d %d %d %d\n", pwm_val[0], pwm_val[1], pwm_val[2], pwm_val[3]);
Serial.print(res);
Serial.print(inputString);
// clear the string:
inputString = "";
stringComplete = false;
for(int idx = 0;idx < 4;idx++)
{
if(pwm_val[idx] > 255) pwm_val[idx] = 255;
if(pwm_val[idx] < 1) pwm_val[idx] = 1;
myservo[idx].write(pwm_val[idx]);
}
}
}
void serialEvent()
{
while(Serial.available())
{
char inChar = (char)Serial.read();
inputString += inChar;
if (inChar == '\n')
{
stringComplete = true;
}
}
}
최초 구동시 Hello가 나오고
콤마로 4개의 값을 넣어주면 된다. 개별 범위는 0~255

[링크 : https://docs.arduino.cc/learn/electronics/servo-motors/]
그나저나 pinMode 설정과 analogWrite() 로는 정상적으로 작동하지 않네.. 머가 문제일까?
| int ledPin = 9; // LED connected to digital pin 9 int analogPin = A0; // potentiometer connected to analog pin A0 int val = 0; // variable to store the read value void setup() { pinMode(ledPin, OUTPUT); // sets the pin as output } void loop() { val = analogRead(analogPin); // read the input pin analogWrite(ledPin, val / 4); // analogRead values go from 0 to 1023, analogWrite values from 0 to 255 } |
[링크 : https://support.arduino.cc/hc/en-us/articles/9350537961500-Use-PWM-output-with-Arduino]
그래서 찾아보니
servo는 대부분 pwm이 아니라는 이야기. 아.. 그렇지! pwm이 아니지?!

[링크 : https://forum.arduino.cc/t/analogwrite-vs-servo-write/370486/3]
[링크 : https://forum.arduino.cc/t/servo-with-analogwrite/438505/7]
| 아두이노 나노 전류 (0) | 2025.10.14 |
|---|---|
| 아두이노 시리얼 이벤트 핸들러 (0) | 2025.10.09 |
| 퀄컴 아두이노 인수 (0) | 2025.10.08 |
| 아두이노 sd 카드 (0) | 2025.08.24 |
| skt-444 콘덴서 마이크 모듈 분해 (0) | 2025.08.07 |
대부분의 경우 소수점 자리만 제한하는데
정수쪽도 길이 제한할일이 있어서 찾아보는데 묘하게 자료가 없어서 테스트 해봄
다만 리눅스에서 한거라 윈도우에서는 다를수 있음
void main()
{
float a = -12.12334;
printf("%f\n", a);
printf("%4.1f\n",a);
printf("%5.1f\n",a);
printf("%6.1f\n",a);
printf("%7.1f\n",a);
printf("%7.2f\n",a);
printf("%7.3f\n",a);
printf("%9.1f\n",a);
printf("%9.2f\n",a);
printf("%9.3f\n",a);
}
| $ ./a.out -12.123340 -12.1 -12.1 -12.1 -12.1 -12.12 -12.123 -12.1 -12.12 -12.123 |
%7.1f / %7.2f / %7.3f 와
%9.1f / %9.2f / %9.3f 가
어떻게 보면 내가 하고 싶었던 결과인데 자리를 정리하면 아래와 같이 나온다.
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
| %7.3f | - | 1 | 2 | . | 1 | 2 | 3 | ||
| %9.3f | - | 1 | 2 | . | 1 | 2 | 3 |
정리하자면
%n.mf 에서
n은 정수 부분, 소수점, 부호 를 포함한 전체 길이이고
m은 그중 소수점의 자릿수. m은 n 보다 작아야 한다.
| free(): invalid next size (normal) (0) | 2023.12.18 |
|---|---|
| c에서 cpp 함수 불러오기 (0) | 2023.01.04 |
| MSB / LSB 변환 (0) | 2022.08.29 |
| kore - c restful api server (1) | 2022.07.07 |
| fopen exclusivly (0) | 2021.07.09 |
대충~ 3.10 부터 추가되었다는 이야기
| def http_error(status): match status: case 400: return "Bad request" case 404: return "Not found" case 418: return "I'm a teapot" case _: return "Something's wrong with the internet" Note the last block: the “variable name” _ acts as a wildcard and never fails to match. If no case matches, none of the branches is executed. You can combine several literals in a single pattern using | (“or”): case 401 | 403 | 404: return "Not allowed" class Point: x: int y: int def where_is(point): match point: case Point(x=0, y=0): print("Origin") case Point(x=0, y=y): print(f"Y={y}") case Point(x=x, y=0): print(f"X={x}") case Point(): print("Somewhere else") case _: print("Not a point") |
[링크 : https://docs.python.org/ko/3.10/tutorial/controlflow.html#match-statements]
[링크 : https://okeybox.tistory.com/395]
[링크 : https://leapcell.io/blog/ko/python-eseo-switch-muneul-jakseonghaneun-bangbeop-2025-switch-case-yeeje]
[링크 : https://www.bangseongbeom.com/python-switch-case]
PEP - Program Enhance Proposal
[링크 : https://wikidocs.net/7896]
2020년에 작성되었고, 3.10 버전에 추가됨.
| PEP 636 – Structural Pattern Matching: Tutorial Author: Daniel F Moisset <dfmoisset at gmail.com> Sponsor: Guido van Rossum <guido at python.org> BDFL-Delegate: Discussions-To: Python-Dev list Status: Final Type: Informational Created: 12-Sep-2020 Python-Version: 3.10 Post-History: 22-Oct-2020, 08-Feb-2021 Resolution: Python-Committers message |
[링크 : https://peps.python.org/pep-0636/]
아니 본인이 2006년에 썼다가 reject 했어?
| PEP 3103 – A Switch/Case Statement Author:Guido van Rossum <guido at python.org> Status:Rejected Type:Standards Track Created:25-Jun-2006 Python-Version:3.0 Post-History:26-Jun-2006 |
| python __name__ (0) | 2025.09.29 |
|---|---|
| python flask를 이용한 static web + rest api server 구현 (0) | 2025.09.29 |
| python simsimd (0) | 2025.08.28 |
| python 원하는 버전 설치 및 연결하기 (0) | 2025.08.26 |
| pip 패키지 완전 삭제하기 (0) | 2025.08.13 |
오랫만에 스타필드 가서 먼가 이것저것 많이 간식을 사옴(!)
원래는 반찬거리 사러 간건가 이게 머야!
| 왜 반차는 더 피곤할까 (0) | 2025.10.27 |
|---|---|
| 아버지 차 구매 예약 (0) | 2025.10.25 |
| 개피곤 (0) | 2025.09.23 |
| 소소한 휴가(?) 끝 (1) | 2025.09.14 |
| 휴가 처갓댁 (0) | 2025.09.12 |
예제로 맨날 폴링만 보다보니 인터럽트가 될거라 생각을 못했네..
| /* SerialEvent occurs whenever a new data comes in the hardware serial RX. This routine is run between each time loop() runs, so using delay inside loop can delay response. Multiple bytes of data may be available. */ void serialEvent() { while (Serial.available()) { // get the new byte: char inChar = (char)Serial.read(); // add it to the inputString: inputString += inChar; // if the incoming character is a newline, set a flag so the main loop can // do something about it: if (inChar == '\n') { stringComplete = true; } } } |
[링크 : https://docs.arduino.cc/built-in-examples/communication/SerialEvent]
| 아두이노 나노 전류 (0) | 2025.10.14 |
|---|---|
| arduino nano로 4채널 pwm 출력하기 (0) | 2025.10.11 |
| 퀄컴 아두이노 인수 (0) | 2025.10.08 |
| 아두이노 sd 카드 (0) | 2025.08.24 |
| skt-444 콘덴서 마이크 모듈 분해 (0) | 2025.08.07 |
망할(?) 케이팝 데몬 헌터스의 영향으로 추석 마지막 날에도 한국인/외국인들이 넘쳐났다.
10년 전에는 자전거타고 침흘리며 올라갔는데, 드디어(!) 버스를 타고 올라와봄
장충체육관 쪽에서 01A 01B를 타려고 한 7대 보내고
부랴부랴 타고 올라와서 애들이 힘들줄을 모르는 듯 ㅋㅋㅋ

저 멀리(?) 너무 잘 보이는 롯데타워


| 눈 @.@ (0) | 2024.11.27 |
|---|---|
| 부웨에에에에엑~ (0) | 2024.10.16 |
| 캐논 카메라 sd 카드 쓰기 잠금 문제 (0) | 2024.06.20 |
| 크랍바디에 대한 오해가 있었구나.. (0) | 2024.06.17 |
| eos 웹캠 유틸리티 (0) | 2024.06.16 |