This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import serial | |
| from time import sleep | |
| ser = serial.Serial ("/dev/ttyACM0", 9600) #Open port with baud rate | |
| while True: | |
| received_data = ser.read() #read serial port | |
| sleep(0.03) | |
| data_left = ser.inWaiting() #check for remaining byte | |
| received_data += ser.read(data_left) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask, render_template_string | |
| import time | |
| app = Flask(__name__) | |
| @app.route('/') | |
| def index(): | |
| return render_template_string('''<p>This is the current value: <span id="latest_value"></span></p> | |
| <script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <time.h> | |
| #include <sys/time.h> | |
| #include <unistd.h> | |
| int main() { | |
| struct timeval tv; | |
| double begin, end; | |
| // 시작하는 시간 받아오기 | |
| gettimeofday(&tv, NULL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stm32f4xx.h> | |
| //ALL the variables have been defined here | |
| static int i = 0;int bit =0;int speed =0;int res =0; | |
| // refernce and pid related constants | |
| int ref_speed = 120;float duty =0;int iteration_time =0; | |
| //errors variables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| sock.connect(("WIFI ADDRESS", 5101)) | |
| while(True): | |
| # 접속할 서버의 ip주소와 포트번호를 입력. sock.send('Hello'.encode()) | |
| inputdata=input() | |
| sock.send(inputdata.encode()) # 내가 전송할 데이터를 보냄. | |
| data=sock.recv(1024) | |
| print(data.decode('utf-8')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends 'base.html' %} | |
| {% block title %}Setting{% endblock %} | |
| {% block head %} | |
| {{ super() }} | |
| <!--<style type="text/css"> | |
| .important { color: #336699; } | |
| </style> | |
| --> | |
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <queue> | |
| #include <list> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <tuple> | |
| using namespace std; | |
| tuple<int, vector<int>> tenConvertTwo(int num){ | |
| vector<int> temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <queue> | |
| #include <list> | |
| #include <vector> | |
| #include <algorithm> | |
| #include <tuple> | |
| #include <cmath> | |
| using namespace std; | |
| vector<int> conversion(int bit_size, int num_toC){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 실시간 데이터처리를 위한 Ring Buffer(고정길이 큐, FixedQueue) 구현 | |
| from typing import Any | |
| class RingBuffer: | |
| class Empty(Exception): | |
| ''' | |
| 비어있는 RingBuffer에서 디큐 또는 피크할 떄 내보내는 예외 처리 | |
| ''' | |
| pass |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pyupbit | |
| import pandas | |
| import numpy | |
| ticker =pyupbit.get_tickers() | |
| print(ticker) | |
| # 과거 데이터 조회 | |
| df = pyupbit.get_ohlcv("KRW-BTC",) |