浏览器操作COM(串口)库
<!DOCTYPE html>
<html>
<head>
<head>
<style>
body {
color: rgb(248, 248, 242);
background-color: rgb(39, 40, 34);
}
.row {
display: flex;
}
.column {
flex: 50%;
}
.head {
height: 50px;
}
.toolbar {
height: 20px;
}
.content {
height: calc(100vh - 20px - 50px - 40px - 20px);
overflow-y: scroll;
border: 1px solid grey;
}
.tail {
height: 20px;
}
</style>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
</head>
</head>
<body>
<div class="head">
<h1>CircuitPython 在线编辑器
<button id="connect" onClick='clickConnect()'> 连接 </button>
<button
onclick="window.open('https://docs.google.com/forms/d/e/1FAIpQLSdupiJIRViFwPpuQC1hMp8gRvhxACLoAjgepm_-IRZumwK7Cg/viewform?usp=sf_link')"
style="float: right;">
反馈
</button>
</h1>
</div>
<div class="row">
<div class="column toolbar">
编辑器
<button id="inputfile"> 打开 </button>
<button id="save" onClick='save_and_run(editor)'> 保存并运行 </button>
<button onclick="save_code()">另存为</button>
<button onclick="new_tab()">新标签页</button>
<text id="filename"></text>
</div>
<div class="column toolbar">
串口
<button onClick="serial.setValue('')"> 清除 </button>
<button onclick="savelog()">保存 log</button>
<button onclick="sendCTRLC()">CTRL-C</button>
<button onclick="sendCTRLD()">CTRL-D</button>
<button onclick="window.open('https://github.com/urfdvw/CircuitPython-online-IDE#workflow-aka-how-to-use')"
style="float: right;">
IDE 帮助
</button>
</div>
</div>
<div class="row">
<div class="column content">
<div id="my-div">
</div>
</div>
<div class="column content">
<div id='out_frame'>
<div id="serial_R">
</div>
<div id="serial_T">
</div>
</div>
</div>
</div>
<div class="tail">
参考:
<button onclick="window.open('https://circuitpython.readthedocs.io/en/latest/docs/index.html')">
CircuitPython API
</button>
<button onclick="window.open('https://circuitpython.readthedocs.io/projects/bundle/en/latest/')">
库和驱动
</button>
<button onclick="window.open('https://circuitpython.readthedocs.io/en/latest/docs/library/index.html')">
MicroPython 库
</button>
<button onclick="window.open('https://circuitpython.org/')">
CircuitPython 网站
</button>
<button id="send_setting" onclick="change_send_key();" style="float: right;">
[Enter] 发送
</button>
</div>
<script type="text/javascript" src="code.js">
</script>
</body>
</html>
code.zip