原生js+css模仿esp32开发板嵌入式仿真模拟编程运行代码
代码语言:html
所属分类:其他
代码描述:原生js+css模仿esp32开发板嵌入式仿真模拟编程运行代码,可以编写代码控制右侧单片机开发板芯片的信号输出。
代码标签: 原生 js css 模仿 esp32 开发板 嵌入式 仿真 模拟 编程 运行 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESP32 开发板仿真模拟器</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
min-height: 100vh;
color: #fff;
}
.header {
background: linear-gradient(90deg, #0f3460, #533483);
padding: 15px 30px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.header h1 {
font-size: 24px;
display: flex;
align-items: center;
gap: 10px;
}
.header h1 .chip-icon {
width: 35px;
height: 35px;
background: #00d9ff;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
}
.status-bar {
display: flex;
gap: 20px;
align-items: center;
}
.status-item {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 15px;
background: rgba(255,255,255,0.1);
border-radius: 20px;
font-size: 14px;
}
.status-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: #ff4757;
}
.status-dot.running {
background: #2ed573;
animation: pulse 1s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
.main-container {
display: grid;
grid-template-columns: 1fr 400px 350px;
gap: 20px;
padding: 20px;
height: calc(100vh - 70px);
}
.panel {
background: rgba(255,255,255,0.05);
border-radius: 15px;
border: 1px solid rgba(255,255,255,0.1);
overflow: hidden;
display: flex;
flex-direction: column;
}
.panel-header {
background: rgba(255,255,255,0.1);
padding: 12px 20px;
font-weight: 600;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
.panel-content {
flex: 1;
overflow: auto;
padding: 15px;
}
/* 代码编辑器 */
.code-editor {
width: 100%;
height: 100%;
background: #0d1117;
border: none;
color: #c9d1d9;
font-family: 'Consolas', 'Monaco', monospace;
font-size: 14px;
line-height: 1.6;
padding: 15px;
resize: none;
outline: none;
}
.editor-controls {
display: flex;
gap: 10px;
}
.btn {
padding: 8px 20px;
border: none;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s;
display: flex;
align-items: center;
gap: 8px;
}
.btn-run {
background: linear-gradient(135deg, #2ed573, #17c964);
color: #fff;
}
.btn-run:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(46, 213, 115, 0.4);
}
.btn-stop {
background: linear-gradient(135deg, #ff4757, #ff3838);
color: #fff;
}
.btn-stop:hover {
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(255, 71, 87, 0.4);
}
.btn-reset {
background: linear-gradient(135deg, #ffa502, #ff7f50);
color: #fff;
}
.btn-upload {
background: linear-gradient(135deg, #3742fa, #5352ed);
color: #fff;
}
/* ESP32 开发板 */
.esp32-board {
background: linear-gradient(180deg, #1a1a1a 0%, #2d2d2d 100%);
border-radius: 10px;
padding: 20px;
position: relative;
border: 3px solid #404040;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.board-label {
text-align: center;
font-size: 12px;
color: #888;
margin-bottom: 15px;
}
.board-label .model {
font-size: 16px;
color: #00d9ff;
font-weight: bold;
}
.chip {
width: 80px;
height: 80px;
background: linear-gradient(135deg, #333, #1a1a1a);
border: 2px solid #555;
border-radius: 5px;
margin: 20px auto;
display: flex;
align-items: center;
justify-content: center;
font-size: 10px;
color: #aaa;
text-align: center;
position: relative;
}
.chip::before {
content: '';
position: absolute;
width: 10px;
height: 10px;
background: #444;
border-radius: 50%;
top: 5px;
left: 5px;
}
.pins-container {
display: flex;
justify-content: space-between;
margin-top: 20px;
}
.pins-column {
display: flex;
flex-direction: column;
gap: 4px;
}
.pin {
display: flex;
align-items: center;
gap: 8px;
font-size: 11px;
padding: 3px 8px;
background: rgba(255,255,255,0.05);
border-radius: 4px;
cursor: pointer;
transition: all 0.2s;
}
.pin:hover {
background: rgba(255,255,255,0.15);
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0