以下是processing的发送程序:

import processing.serial.*;

Serial myPort; //创建串口对象 int level = 1; //初始化电梯当前楼层为1

void setup() { size(200, 200); myPort = new Serial(this, "COM3", 9600); //设置串口号和波特率 }

void draw() { background(255); fill(0); textSize(20); text("Current Level: " + level, 20, 50); //显示当前楼层 text("Press 1-9 to select floor", 20, 100); }

void keyPressed() { if (key >= '1' && key <= '9') { //如果按下的键是数字键1-9 level = key - '0'; //将楼层设置为对应数字 myPort.write(key); //向单片机发送选中的楼层 }

我将给出51单片机的接收程序请你给出processing的发送程序接收程序如下#include reg51h#include intrinsh#define uchar unsigned char#define uint unsigned intuchar code Table=	0x3C0x420x420x420x420x420x420x3C0	0x180x380x780x180x180x180

原文地址: http://www.cveoy.top/t/topic/dHQ4 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录