原始问题:
在网页端控制stm32灯的亮灭的前后端流程及代码
前端:
- 利用HTML页面和CSS样式表实现网页布局;
- 利用JavaScript语言实现对按钮的操作,当按下开关按钮时发送AJAX请求到后端;
采用AJAX进行异步数据传输。
前端代码如下:
<!DOCTYPE html>
STM32 body { background-color: #fcfcfc; font-family: Helvetica, arial, freesans, clean, sans-serif; } #light { width: 150px; height: 150px; background-color: rgba(255, 255, 255, 0.5); margin: 0 auto; border-radius: 50%; position: relative; } #light::after { content:""; width: 60px; height: 60px; background-color:#fff ; position : absolute ; top : 50% ; left : 50% ; margin : -30px 0 0 -30px ; border-radius : 50% ; box-shadow : 0 3px 6px rgba(0 ,0 ,0 , .3) inset ; } #light div { width : 100% ; height : 100% ; position : absolute ; top : 0 ; left : 0;} #btn { display: block; width: 200px; margin: 20px auto;}