blockly实现可视化积木编程esp32单片机嵌入式开发板模拟器代码

代码语言:html

所属分类:其他

代码描述:blockly实现可视化积木编程esp32单片机嵌入式开发板模拟器代码

代码标签: blockly 可视化 积木 编程 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 Blockly 在线仿真器</title>
    
    <!-- 引入 Blockly -->
    <script src="https://unpkg.com/blockly@10.0.0/blockly.min.js"></script>
    <script src="https://unpkg.com/blockly@10.0.0/javascript_compressed.js"></script>
    <script src="https://unpkg.com/blockly@10.0.0/msg/zh-hans.js"></script>

    <style>
        body { margin: 0; font-family: 'Consolas', sans-serif; display: flex; height: 100vh; background: #1e1e1e; color: #fff; }
        
        /* 布局 */
        #editor-col { width: 60%; height: 100%; display: flex; flex-direction: column; }
        #sim-col { width: 40%; background: #2d2d2d; border-left: 1px solid #444; display: flex; flex-direction: column; align-items: center; padding: 20px; box-sizing: border-box; }

        /* Blockly 区域 */
        #blockly-div { flex: 1; width: 100%; }
        
        /* 顶部工具栏 */
        .toolbar { background: #333; padding: 10px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid #444; }
        h1 { margin: 0 15px 0 0; font-size: 18px; color: #00979d; } /* Arduino Teal */
        button { 
            padding: 8px 15px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; font-family: inherit;
        }
        #btn-run { background: #00979d; color: white; }
        #btn-run:hover { background: #007f84; }
        #btn-stop { background: #d32f2f; color: white; display: none; }
        
        /* ESP32 仿真板样式 */
        .esp32-board {
            width: 220px;
            height: 360px;
            background: #000;
            border-radius: 10px;
            border: 2px solid #555;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0