전체 글
-
Ch.06 Flask를 활용하여 센서 제어하기Raspberry Pi ( python ) 2023. 3. 7. 15:22
1 _ 프레임워크, Flask란? : 프레임워크는 앱이나 웹, 소프트웨어를 개발하기위해 들어가는 노력과 시간을 줄여주고자 다양한 기능을 집합시켜서 개발자가 개발에만 집중할 수 있도록 도와주는 역할을 한다. 대표적으로 장고(Django)와 플라스크(Flask)가 있는데, 장고는 큰 프로젝트를 진행하는데 유리한 프레임워크이다. 여기서는 가벼운 플라스크를 활용할 것이다. ** 라즈베리 파이에서 Flask를 사용하고싶다면, VS code와 flask를 라즈비안에 다운받고 Vs code의 터미널에서 python을 실행한 뒤 flask를 import한다. 2 _ Flask 웹 서버 구축하기 폴더와 파일 구성 webapps -ch06 -helloworld -app_start.py 코드 리뷰 from flask imp..
-
nomad) python 기초 (2)Python 2023. 3. 6. 12:14
https://nomadcoders.co/python-for-beginners 1 _ For Loops : 기본형태 for placeholder in 반복할요소: 실행문 -> 반복할요소 내부의 인수들을 각각 placeholder를 붙여서 실행문을 실행한다. - websites의 모든 인수들을 불러와서 each에 저장시킨 다음 실행문을 실행한다. ( 모든 인수가 실행문을 실행할 때 까지 ) 2 _ For, If 문 활용 : list 내부의 링크들이 이동 가능한지 확인하기 websites 내부 string들의 시작부분에 https:// 가 있는지 검사해서 없으면 추가해주는 코드 ** if not website.startswith("https://") -> if not : 만약 ~가 아니면 이후에 따라올 실행..
-
nomard) python 기초 (1)Python 2023. 3. 6. 11:12
https://nomadcoders.co/python-for-beginners 1 _ 파이썬 기초 문법 : 기본적으로 print() 같은 명령어는 똑같이 쓰인다. - 정보를 입력 받고 싶을 때 input("사용자에게 하고싶은 말") : input을 이용하면 사용자에게 값을 입력받는 것은 물론 특정한 값을 입력해달라고 명시할 수 있다. input으로 입력받은 값은 string 형태이므로 값이 숫자라면 int(input()) 으로 바꿔서 저장해야한다 변수 = int(input("숫자를 입력해주세요")) 2 _ 조건문 ( if / else / elif ) if 문 if condition: 실행문 else 문 if condition: 실행문 else: 실행문 elif 문 if condition: 실행문 elif..
-
yalco) Git hub기타 2023. 3. 5. 17:55
https://www.youtube.com/watch?v=1I3hMwQU6GU ** Yalco 유투브의 GitHub 무료강의를 정리했다. 1 _ 윈도우 세팅 ** 설치 시 Git Bash를 반드시 포함시킬 것 git config --global core.autocrlf true 협업 시 윈도우와 맥에서 엔터 방식 차이로 인한 오류를 방지 - VS code의 기본 터미널을 Git Bash로 설정 VS code에서 ctrl + shift + p Select Default Profile 선택 Git Bash 선택 ( Git Bash를 C 드라이브에 설치해야 해당 설정이 가능하다 ) ** Git 등 프로그래밍 관련 소프트웨어들은 C드라이브에 설치해야 연계가 원활하다. 2 _ Git의 사용 방식 CLI : 터미널..
-
CH.05 라즈베리파이 GPIO 및 센서 활용하기Raspberry Pi ( python ) 2023. 3. 3. 15:28
1 _ GPIO 제어 및 테스트 1) 지니의 설정을 바꿔서 python 코드를 읽을 수 있게 만들기. 제작 -> 빌드설정으로 이동 Compile에 python3으로 변경 Execute에서 python3으로 변경 2) 파이썬 코드 작성하기 ** 코드 마지막에 GPIO.cleanup()은 스크립트 실행 시에 GPIO 모드 세팅 등을 초기화하고 리소스를 반환시켜서 중복이나 GPIO핀 쇼트 등의 하드웨어적인 문제를 방지할 수 있다. GPIO 4번 핀에 1초 동안 신호를 주고 1초동안 신호를 꺼서 LED가 10회 깜빡이도록 만들었다. import RPi.GPIO as GPIO -> as GPIO 명령어로 RPi.GPIO 모듈이름을 GPIO로 요약해서 사용할 수 있다 import time -> RPi.GPIO 모듈..
-
CH.04 라즈베리 파이를 위한 전자 기초 배우기Raspberry Pi ( python ) 2023. 3. 3. 09:34
1 _ 알기 쉬운 전자회로 1) 옴의 법칙 V = I * R 2) 콘덴서 : 축전기 (capacitor : 커패시터) 또는 콘던서 라고 부르며 전기를 저장할 수 있는 장치다. 콘덴서의 용량만큼 저장된 이후에는 전류가 흐르지 않는다. 콘덴서에 직류 전원을 연결하면 일정시간동안 충전되다가 전류가 흐르지 않는데, 만약 교류 전원을 연결하면 충전과 방전을 반복하면서 전류가 흐르게 된다. 콘덴서는 직류를 차단하고 교류를 통과한다. 3) 트렌지스터 : 트렌지스터는 크게 두 가지로 기능이 나뉜다. 증폭기능, 스위치 기능 트렌지스터는 3개의 다리가 있는데 각 부분을 다음과 같이 물이 지나가는 파이프의 밸브에 비유할 수 있다. 콜렉터 : 밸브의 물이 들어가는 입구 에미터 : 밸브의 물이 나가는 출구 베이스 : 밸브를 열..
-
CH.02 라즈베리 파이를 위한 리눅스 기초 배우기Raspberry Pi ( python ) 2023. 2. 28. 11:31
1 _ 리눅스 운영체제의 종류 : 리눅스 운영체제는 대형기종에 작업이 가능한 유닉스를 개인용 컴퓨터에서 작동할 수 있게 변형한 것이라고 볼 수 있다. 리눅스의 가장 큰 특징은 GNU 정신을 준수하기 때문에 대부분 무료이고 소스코드의 자유배포가 가능하다. 대표적인 리눅스의 종류는 Debian, Redhat 이 있다. 2 _ 원격 접속을 위한 VNC와 Putty : 라즈비안에 모니터, 키보드, 마우스를 연결하여 직접적으로 사용할 수 있지만 원격 접속하는 방법이 있다. CLI는 터미널 모드로 접속하기, GUI는 그래픽 모드로 접속하는 것이다. - 그래픽 모드 접속 1) www.realvnc.com/en/connect/download/vnc/ Download VNC Server | VNC® Connect Ena..
-
Ch01. 라즈베리파이 시작하기Raspberry Pi ( python ) 2023. 2. 27. 15:14
1 _ SD Card Format SD Card Formatter를 다운받아서 작업을 진행하기 전 SD Card를 포맷할 수 있습니다. 링크 : http://sd-card-formatter.kr.uptodown.com/windows/download SD Card Formatter 5.0.2을 위한 Windows을 다운로드하세요 | Uptodown.com 탄탄하고 용도가 다양하며, 맞춤 설정도 가능한 브라우저 컴퓨터 작업 손쉽게 자동화하기 DOS 를 위해 부팅가능한 USB를 만드세요. 사용중이거나, 보호되고 있거나 금지된 파일들을 삭제하세요 sd-card-formatter.kr.uptodown.com Volume label에 raspberry 라고 작성한 뒤, Overwrite format을 체크한 후 F..