Python
-
baudratePython/Raspberry Pi 2021. 10. 20. 10:36
보오 레이트(baud rate) Data Cummunication speed TCP/IP or 시리얼통신 2008. 12. 26. 10:06 보오 레이트(baud rate)란 1초당의 변조횟수인데, RS232C 인터페이스에서 변조횟수와 전송속도(bps:bit per second)가 일치하므로 단위로서는 보오(baud) 또는 bps가 사용된다. 데이터의 전송속도는 송수신에 필요한 프로그램의 실행속도와 통신 케이블 등의 통신매체의 특성에 따라 크게 좌우된다. ※ 보오는 1초당 변조횟수이고, bps는 1초당의 전송 횟수이다. 따라서 변조방식을 연구하면 1회의 변조에 의해 2비트 또는 그이상의 정보량을 전송할 수 있다. RS232C 인터페이스는 전압의 High와 Low로 변조(AM 변조)하고 있으므로 1회의 변..
-
메모리 주소값 불러오는 함수 id()Python/기초 2021. 10. 18. 09:16
a = [1, 2, 3] id(a) >>> 4303029896 b = a # 같은 주소를 참조 id(a) >>> 4303029896 id(b) >>> 4303029896 a is b # is 동일한 객체를 가리키고 있는지 판단하는 명령어 >>> True @ 주소값 다르게 복사 방법 1. b = a[:] 2. from copy import copy a = [1, 2, 3] b = copy(a) @ 변수 바꾸기 a = 3 b = 5 a, b = b, a >>> a 5 >>> b 3
-
Python - ListPython/기초 2021. 10. 15. 17:08
@리스트 요소 추가 a = [1, 2, 3] a.append(4) print(a) [1, 2, 3, 4] @리스트 정렬(sort) a = [1, 4, 3, 2] a.sort() print(a) >>> [1, 2, 3, 4] @문자도 알파벳 순서로 정렬가능 a = ['a', 'c', 'b'] a.sort() print(a) >>>['a', 'b', 'c'] @리스트 뒤집기(reverse) a = ['a', 'c', 'b'] a.reverse() print(a) ['b', 'c', 'a'] @위치 반환(index) # 리스트값을 넣으면 값의 위치를 반환 a = [1, 2, 3] print(a.index(3)) >>>2 print(a.index(1)) >>>2 @리스트에 요소 삽입(insert) a = [1,..
-
자료형Python/기초 2021. 10. 15. 15:14
** 연산자 # a의b제곱 >>>a ** b % 연산자 # 나눗셈 후 나머지를 반환 >>>3 % 7 3 // 연산자 #나눗셈 후 몫을 반환 >>>7/4 1 # \n없이 개행 multiline = """ Life is too short You need python """ print(multiline) \n 문자열 안에서 줄을 바꿀 때 사용 \t 문자열 사이에 탭 간격을 줄 때 사용 \\ 문자\를 그대로 표현할 대 사용 \' '그대로 사용할때 \" "그대로 표현할 때 \r 캐리지 리턴(줄 바꿈 문자, 현재 커서를 가장 앞으로 이동) \f 폼 피드(줄 바꿈 문자, 현재 커서를 다음 줄로 이동) \a 벨 소리(출력할때 PC스피커에서 '삑'소리가 난다) \b 백스페이스 \000 널 문자 문자열 더하기 head =..
-
Raspberry pi wifi change without rebootPython/Raspberry Pi 2021. 10. 14. 13:02
import sys import shutil # 파일 카피위해 import os # 터미널 cmd명령어 입력위해 dhcpcd_name = '/dhcpcd.conf' wpa_name = '/wpa_supplicant.conf' from_dir1 = '/home/pi/TM_TECU/WIFI_CHG1' from_dir2 = '/home/pi/TM_TECU/WIFI_CHG2' from_dir3 = '/home/pi/TM_TECU/WIFI_CHG3' to_dhcpcd = '/etc/dhcpcd.conf' to_wpa = '/etc/wpa_supplicant/wpa_supplicant.conf' # reboot 없이 # to_wpa = '/boot/wpa_supplicant.conf' # reboot해야만 작동 d..
-
라즈베리 파이 WIFI 및 고정 IP할당Python/Raspberry Pi 2021. 10. 13. 15:39
@ 라즈베리파이 WIFI 설정 SD카드에 라즈베리파이OS ( https://www.raspberrypi.com/software/) 다운 후 설치 1. SD카드 boot폴더(최상위 폴더)에 ssh 파일 새로만들기(확장자X) # 원격ssh 접속위함 2. SD카드 boot폴더(최상위 폴더)에 wpa_supplicant.conf 만들기 (확장자 .conf) WIFI 설정위함 wpa_supplicant.conf 파일 메모장으로 OPEN 아래 코드 입력 # 192.168.01 or 라즈베리파이와 연결할 공유기 ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="접속할 WIFI 이름" # ex) easytemRD..