欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136
標題:
Arduino Processing控制8x8點陣 附源代碼(第64位總是不對)
[打印本頁]
作者:
探索軟件
時間:
2019-4-4 21:08
標題:
Arduino Processing控制8x8點陣 附源代碼(第64位總是不對)
使用:上位機Processing上畫出8x8點陣圖案,發送數據到Arduino驅動8x8點陣顯示.數據很簡單就是點陣的 1111100011110000.....(64位)發送串口.
問題: 點陣第64位總是不對(黑圈處),希望有高手指點哪里出問題.
88dz.JPG
(36.43 KB, 下載次數: 61)
下載附件
2019-4-4 21:05 上傳
IMG_20190404_202140_1.jpg
(140.59 KB, 下載次數: 54)
下載附件
2019-4-4 21:05 上傳
Arduino代碼:
int R[] = {2,7,A5,5,13,A4,12,A2}; //行
int C[] = {6,11,10,3,A3,4,8,9}; //列
char command;
int mark = 0;
int numdata[8][8];
int data;
char xh;
void setup(){
Serial.begin(9600);
for(int i = 0;i<8;i++){
pinMode(R[i],OUTPUT);
pinMode(C[i],OUTPUT);
}
for(int i = 0;i<8;i++){
for(int j = 0;j<8;j++){
numdata[i][j]=0;
}
}
}
void loop(){
recv_data();
updateServo();
}
void recv_data(){
while(Serial.available()){
for(int i=0;i<8;i++){
numdata[i][0]=Serial.read();
delay(10);
numdata[i][1]=Serial.read();
delay(10);
numdata[i][2]=Serial.read();
delay(10);
numdata[i][3]=Serial.read();
delay(10);
numdata[i][4]=Serial.read();
delay(10);
numdata[i][5]=Serial.read();
delay(10);
numdata[i][6]=Serial.read();
delay(10);
numdata[i][7]=Serial.read();
}
delay(10);
}
mark = 1;
}
void updateServo(){
if(mark == 1){
for(int i = 0 ; i < 100 ; i++) {
for(int c = 0; c< 8;c++){
digitalWrite(C[c],LOW);//選通第c列
for(int r = 0;r< 8;r++){
digitalWrite(R[r],numdata[r][c]);
}
delay(1);
Clear(); //清空顯示去除余暉
}
}
mark == 0;
}
}
void Clear(){
for(int i = 0;i<8;i++){
digitalWrite(R[i],LOW);
digitalWrite(C[i],HIGH);
}
}
Processing 代碼:
//processing端程序
import processing.serial.*;
String comname="COM4";
Serial port;
boolean serial;
byte Serial_StopFlag = 0;
boolean Serial_OpenFlag = false;
boolean Serial_DatareadFlag = false;
boolean Serial_GetdataFlag = false;
PFont myFont;
PFont font;
String[] mesg = new String[8];
String[] command = new String[8];
int a1=0;
int a2=0;
int a3=0;
int a4=0;
int a5=0;
int a6=0;
int a7=0;
int a8=0;
int b1=0;
int b2=0;
int b3=0;
int b4=0;
int b5=0;
int b6=0;
int b7=0;
int b8=0;
int c1=0;
int c2=0;
int c3=0;
int c4=0;
int c5=0;
int c6=0;
int c7=0;
int c8=0;
int d1=0;
int d2=0;
int d3=0;
int d4=0;
int d5=0;
int d6=0;
int d7=0;
int d8=0;
int e1=0;
int e2=0;
int e3=0;
int e4=0;
int e5=0;
int e6=0;
int e7=0;
int e8=0;
int f1=0;
int f2=0;
int f3=0;
int f4=0;
int f5=0;
int f6=0;
int f7=0;
int f8=0;
int g1=0;
int g2=0;
int g3=0;
int g4=0;
int g5=0;
int g6=0;
int g7=0;
int g8=0;
int h1=0;
int h2=0;
int h3=0;
int h4=0;
int h5=0;
int h6=0;
int h7=0;
int h8=0;
byte click = 0;
//初試化
void setup(){
size(700,500);
frameRate(53);
port=new Serial(this,"COM4",9600);
font = createFont("宋體.vlw",48);
textFont(font);
frameRate(30);
smooth();
for(int i=0;i<8;i++){
mesg[i]="0,0,0,0,0,0,0,0";
}
for(int j=0;j<8;j++){
command[j]="0,0,0,0,0,0,0,0,0";
}
}
//主程序
void draw(){
background(255);
inter_face();
CheckBoxHandle1();
CheckBoxHandle2();
CheckBoxHandle3();
CheckBoxHandle4();
CheckBoxHandle5();
CheckBoxHandle6();
CheckBoxHandle7();
CheckBoxHandle8();
}
void inter_face(){
textSize(18);
strokeWeight(2);
fill(0);
text("Processing 控制 8 x 8 點陣",280,20);
line(0,25,700,25);
line(0,450,700,450);
line(0,280,700,280);
textSize(16);
strokeWeight(2);
fill(0);
text("向Arduino發送數據:",5,480);
mesg[0]=a1+","+a2+","+a3+","+a4+","+a5+","+a6+","+a7+","+a8+",";
mesg[1]=b1+","+b2+","+b3+","+b4+","+b5+","+b6+","+b7+","+b8+",";
mesg[2]=c1+","+c2+","+c3+","+c4+","+c5+","+c6+","+c7+","+c8+",";
mesg[3]=d1+","+d2+","+d3+","+d4+","+d5+","+d6+","+d7+","+d8+",";
mesg[4]=e1+","+e2+","+e3+","+e4+","+e5+","+e6+","+e7+","+e8+",";
mesg[5]=f1+","+f2+","+f3+","+f4+","+f5+","+f6+","+f7+","+f8+",";
mesg[6]=g1+","+g2+","+g3+","+g4+","+g5+","+g6+","+g7+","+g8+",";
mesg[7]=h1+","+h2+","+h3+","+h4+","+h5+","+h6+","+h7+","+h8+",";
for(int i=0;i<8;i++){
text(mesg[i],400,50+i*20);
}
if(button(500, 400,"發 送") != 0){
send_data();
}
if(button(590, 400,"退 出") != 0){
exit();
}
}
//send data to Arduino
void send_data(){
for(int i=0;i<8;i++){
command=split(mesg[i],',');
print(command[0]);
print(command[1]);
print(command[2]);
print(command[3]);
print(command[4]);
print(command[5]);
print(command[6]);
print(command[7]);
port.write(int(command[0]));
port.write(int(command[1]));
port.write(int(command[2]));
port.write(int(command[3]));
port.write(int(command[4]));
port.write(int(command[5]));
port.write(int(command[6]));
port.write(int(command[7]));
//delay(1);
}
serial=false;
}
//鼠標
boolean mousePressedFlag = false;
void mousePressed() {
mousePressedFlag = true;
}
boolean SaveFlag = false;
//按鈕
byte button(float x , float y , String str){
byte ret = 0;
fill(0,0,0);
strokeWeight(2);
//stroke(255,255,0);
if((mouseX > x) && (mouseY > y) && (mouseX < (x + 100) ) &&(mouseY < (y + 30))){
fill(128,255,255);
if (mousePressedFlag && (mouseButton == LEFT)) {
mousePressedFlag = false;
fill(0,128,128);
ret = 1;
}
}
rect(x,y, 80, 30);
fill(255,255,255);
textSize(16);
text(str, x + 24, y + 22);
return ret;
}
//舵機角度選擇
boolean a1_checkBox = false;
boolean a2_checkBox = false;
boolean a3_checkBox = false;
boolean a4_checkBox = false;
boolean a5_checkBox = false;
boolean a6_checkBox = false;
boolean a7_checkBox = false;
boolean a8_checkBox = false;
void CheckBoxHandle1(){
if(CheckBox(20,30,a1_checkBox, "")== 1){
a1_checkBox = (a1_checkBox == false) ? true: false;
if(a1_checkBox == true){
a1=1;
}else{
a1=0;
}
}
if(CheckBox(60,30,a2_checkBox, "") == 1){
a2_checkBox = (a2_checkBox == false) ? true: false;
if(a2_checkBox == true){
a2=1;
}else{
a2=0;
}
}
if(CheckBox(100,30, a3_checkBox, "") == 1){
a3_checkBox = (a3_checkBox == false) ? true: false;
if(a3_checkBox == true){
a3=1;
}else{
a3=0;
}
}
if(CheckBox(140,30, a4_checkBox, "") == 1){
a4_checkBox = (a4_checkBox == false) ? true: false;
if(a4_checkBox == true){
a4=1;
}else{
a4=0;
}
}
if(CheckBox(180,30, a5_checkBox, "") == 1){
a5_checkBox = (a5_checkBox == false) ? true: false;
if(a5_checkBox == true){
a5=1;
}else{
a5=0;
}
}
if(CheckBox(220,30, a6_checkBox, "") == 1){
a6_checkBox = (a6_checkBox == false) ? true: false;
if(a6_checkBox == true){
a6=1;
}else{
a6=0;
}
}
if(CheckBox(260,30, a7_checkBox, "") == 1){
a7_checkBox = (a7_checkBox == false) ? true: false;
if(a7_checkBox == true){
a7=1;
}else{
a7=0;
}
}
if(CheckBox(300,30, a8_checkBox, "") == 1){
a8_checkBox = (a8_checkBox == false) ? true: false;
if(a8_checkBox == true){
a8=1;
}else{
a8=0;
}
}
}
boolean checkBox_Geta1Flag(){
return a1_checkBox;
}
boolean checkBox_Geta2Flag(){
return a2_checkBox;
}
boolean checkBox_Geta3Flag(){
return a3_checkBox;
}
boolean checkBox_Geta4lag(){
return a4_checkBox;
}
boolean checkBox_Geta5Flag(){
return a5_checkBox;
}
boolean checkBox_Geta6Flag(){
return a6_checkBox;
}
boolean checkBox_Geta7Flag(){
return a7_checkBox;
}
boolean checkBox_Geta8lag(){
return a8_checkBox;
}
//舵機角度選擇
boolean b1_checkBox = false;
boolean b2_checkBox = false;
boolean b3_checkBox = false;
boolean b4_checkBox = false;
boolean b5_checkBox = false;
boolean b6_checkBox = false;
boolean b7_checkBox = false;
boolean b8_checkBox = false;
void CheckBoxHandle2(){
if(CheckBox(20,60,b1_checkBox, "")== 1){
b1_checkBox = (b1_checkBox == false) ? true: false;
if(b1_checkBox == true){
b1=1;
}else{
b1=0;
}
}
if(CheckBox(60,60,b2_checkBox, "") == 1){
b2_checkBox = (b2_checkBox == false) ? true: false;
if(b2_checkBox == true){
b2=1;
}else{
b2=0;
}
}
if(CheckBox(100,60, b3_checkBox, "") == 1){
b3_checkBox = (b3_checkBox == false) ? true: false;
if(b3_checkBox == true){
b3=1;
}else{
b3=0;
}
}
if(CheckBox(140,60, b4_checkBox, "") == 1){
b4_checkBox = (b4_checkBox == false) ? true: false;
if(b4_checkBox == true){
b4=1;
}else{
b4=0;
}
}
if(CheckBox(180,60, b5_checkBox, "") == 1){
b5_checkBox = (b5_checkBox == false) ? true: false;
if(b5_checkBox == true){
b5=1;
}else{
b5=0;
}
}
if(CheckBox(220,60, b6_checkBox, "") == 1){
b6_checkBox = (b6_checkBox == false) ? true: false;
if(b6_checkBox == true){
b6=1;
}else{
b6=0;
}
}
if(CheckBox(260,60, b7_checkBox, "") == 1){
b7_checkBox = (b7_checkBox == false) ? true: false;
if(b7_checkBox == true){
b7=1;
}else{
b7=0;
}
}
if(CheckBox(300,60, b8_checkBox, "") == 1){
b8_checkBox = (b8_checkBox == false) ? true: false;
if(b8_checkBox == true){
b8=1;
}else{
b8=0;
}
}
}
boolean checkBox_Getb1Flag(){
return b1_checkBox;
}
boolean checkBox_Getb2Flag(){
return b2_checkBox;
}
boolean checkBox_Getb3Flag(){
return b3_checkBox;
}
boolean checkBox_Getb4lag(){
return b4_checkBox;
}
boolean checkBox_Getb5Flag(){
return b5_checkBox;
}
boolean checkBox_Getb6Flag(){
return b6_checkBox;
}
boolean checkBox_Getb7Flag(){
return b7_checkBox;
}
boolean checkBox_Getb8lag(){
return b8_checkBox;
}
//舵機角度選擇
boolean c1_checkBox = false;
boolean c2_checkBox = false;
boolean c3_checkBox = false;
boolean c4_checkBox = false;
boolean c5_checkBox = false;
boolean c6_checkBox = false;
boolean c7_checkBox = false;
boolean c8_checkBox = false;
void CheckBoxHandle3(){
if(CheckBox(20,90,c1_checkBox, "")== 1){
c1_checkBox = (c1_checkBox == false) ? true: false;
if(c1_checkBox == true){
c1=1;
}else{
c1=0;
}
}
if(CheckBox(60,90,c2_checkBox, "") == 1){
c2_checkBox = (c2_checkBox == false) ? true: false;
if(c2_checkBox == true){
c2=1;
}else{
c2=0;
}
}
if(CheckBox(100,90, c3_checkBox, "") == 1){
c3_checkBox = (c3_checkBox == false) ? true: false;
if(c3_checkBox == true){
c3=1;
}else{
c3=0;
}
}
if(CheckBox(140,90, c4_checkBox, "") == 1){
c4_checkBox = (c4_checkBox == false) ? true: false;
if(c4_checkBox == true){
c4=1;
}else{
c4=0;
}
}
if(CheckBox(180,90, c5_checkBox, "") == 1){
c5_checkBox = (c5_checkBox == false) ? true: false;
if(c5_checkBox == true){
c5=1;
}else{
c5=0;
}
}
if(CheckBox(220,90, c6_checkBox, "") == 1){
c6_checkBox = (c6_checkBox == false) ? true: false;
if(c6_checkBox == true){
c6=1;
}else{
c6=0;
}
}
if(CheckBox(260,90, c7_checkBox, "") == 1){
c7_checkBox = (c7_checkBox == false) ? true: false;
if(c7_checkBox == true){
c7=1;
}else{
c7=0;
}
}
if(CheckBox(300,90, c8_checkBox, "") == 1){
c8_checkBox = (c8_checkBox == false) ? true: false;
if(c8_checkBox == true){
c8=1;
}else{
c8=0;
}
}
}
boolean checkBox_Getc1Flag(){
return c1_checkBox;
}
boolean checkBox_Getc2Flag(){
return c2_checkBox;
}
boolean checkBox_Getc3Flag(){
return c3_checkBox;
}
boolean checkBox_Getc4lag(){
return c4_checkBox;
}
boolean checkBox_Getc5Flag(){
return c5_checkBox;
}
boolean checkBox_Getc6Flag(){
return c6_checkBox;
}
boolean checkBox_Getc7Flag(){
return c7_checkBox;
}
boolean checkBox_Getc8lag(){
return c8_checkBox;
}
//舵機角度選擇
boolean d1_checkBox = false;
boolean d2_checkBox = false;
boolean d3_checkBox = false;
boolean d4_checkBox = false;
boolean d5_checkBox = false;
boolean d6_checkBox = false;
boolean d7_checkBox = false;
boolean d8_checkBox = false;
void CheckBoxHandle4(){
if(CheckBox(20,120,d1_checkBox, "")== 1){
d1_checkBox = (d1_checkBox == false) ? true: false;
if(d1_checkBox == true){
d1=1;
}else{
d1=0;
}
}
if(CheckBox(60,120,d2_checkBox, "") == 1){
d2_checkBox = (d2_checkBox == false) ? true: false;
if(d2_checkBox == true){
d2=1;
}else{
d2=0;
}
}
if(CheckBox(100,120, d3_checkBox, "") == 1){
d3_checkBox = (d3_checkBox == false) ? true: false;
if(d3_checkBox == true){
d3=1;
}else{
d3=0;
}
}
if(CheckBox(140,120, d4_checkBox, "") == 1){
d4_checkBox = (d4_checkBox == false) ? true: false;
if(d4_checkBox == true){
d4=1;
}else{
d4=0;
}
}
if(CheckBox(180,120, d5_checkBox, "") == 1){
d5_checkBox = (d5_checkBox == false) ? true: false;
if(d5_checkBox == true){
d5=1;
}else{
d5=0;
}
}
if(CheckBox(220,120, d6_checkBox, "") == 1){
d6_checkBox = (d6_checkBox == false) ? true: false;
if(d6_checkBox == true){
d6=1;
}else{
d6=0;
}
}
if(CheckBox(260,120, d7_checkBox, "") == 1){
d7_checkBox = (d7_checkBox == false) ? true: false;
if(d7_checkBox == true){
d7=1;
}else{
d7=0;
}
}
if(CheckBox(300,120, d8_checkBox, "") == 1){
d8_checkBox = (d8_checkBox == false) ? true: false;
if(d8_checkBox == true){
d8=1;
}else{
d8=0;
}
}
}
boolean checkBox_Getd1Flag(){
return d1_checkBox;
}
boolean checkBox_Getd2Flag(){
return d2_checkBox;
}
boolean checkBox_Getd3Flag(){
return d3_checkBox;
}
boolean checkBox_Getd4lag(){
return d4_checkBox;
}
boolean checkBox_Getd5Flag(){
return d5_checkBox;
}
boolean checkBox_Getd6Flag(){
return d6_checkBox;
}
boolean checkBox_Getd7Flag(){
return d7_checkBox;
}
boolean checkBox_Getd8lag(){
return d8_checkBox;
}
//舵機角度選擇
boolean e1_checkBox = false;
boolean e2_checkBox = false;
boolean e3_checkBox = false;
boolean e4_checkBox = false;
boolean e5_checkBox = false;
boolean e6_checkBox = false;
boolean e7_checkBox = false;
boolean e8_checkBox = false;
void CheckBoxHandle5(){
if(CheckBox(20,150,e1_checkBox, "")== 1){
e1_checkBox = (e1_checkBox == false) ? true: false;
if(e1_checkBox == true){
e1=1;
}else{
e1=0;
}
}
if(CheckBox(60,150,e2_checkBox, "") == 1){
e2_checkBox = (e2_checkBox == false) ? true: false;
if(e2_checkBox == true){
e2=1;
}else{
e2=0;
}
}
if(CheckBox(100,150, e3_checkBox, "") == 1){
e3_checkBox = (e3_checkBox == false) ? true: false;
if(e3_checkBox == true){
e3=1;
}else{
e3=0;
}
}
if(CheckBox(140,150, e4_checkBox, "") == 1){
e4_checkBox = (e4_checkBox == false) ? true: false;
if(e4_checkBox == true){
e4=1;
}else{
e4=0;
}
}
if(CheckBox(180,150, e5_checkBox, "") == 1){
e5_checkBox = (e5_checkBox == false) ? true: false;
if(e5_checkBox == true){
e5=1;
}else{
e5=0;
}
}
if(CheckBox(220,150, e6_checkBox, "") == 1){
e6_checkBox = (e6_checkBox == false) ? true: false;
if(e6_checkBox == true){
e6=1;
}else{
e6=0;
}
}
if(CheckBox(260,150, e7_checkBox, "") == 1){
e7_checkBox = (e7_checkBox == false) ? true: false;
if(e7_checkBox == true){
e7=1;
}else{
e7=0;
}
}
if(CheckBox(300,150, e8_checkBox, "") == 1){
e8_checkBox = (e8_checkBox == false) ? true: false;
if(e8_checkBox == true){
e8=1;
}else{
e8=0;
}
}
}
boolean checkBox_Gete1Flag(){
return e1_checkBox;
}
boolean checkBox_Gete2Flag(){
return e2_checkBox;
}
boolean checkBox_Gete3Flag(){
return e3_checkBox;
}
boolean checkBox_Gete4lag(){
return e4_checkBox;
}
boolean checkBox_Gete5Flag(){
return e5_checkBox;
}
boolean checkBox_Gete6Flag(){
return e6_checkBox;
}
boolean checkBox_Gete7Flag(){
return e7_checkBox;
}
boolean checkBox_Gete8lag(){
return e8_checkBox;
}
//舵機角度選擇
boolean f1_checkBox = false;
boolean f2_checkBox = false;
boolean f3_checkBox = false;
boolean f4_checkBox = false;
boolean f5_checkBox = false;
boolean f6_checkBox = false;
boolean f7_checkBox = false;
boolean f8_checkBox = false;
void CheckBoxHandle6(){
if(CheckBox(20,180,f1_checkBox, "")== 1){
f1_checkBox = (f1_checkBox == false) ? true: false;
if(f1_checkBox == true){
f1=1;
}else{
f1=0;
}
}
if(CheckBox(60,180,f2_checkBox, "") == 1){
f2_checkBox = (f2_checkBox == false) ? true: false;
if(f2_checkBox == true){
f2=1;
}else{
f2=0;
}
}
if(CheckBox(100,180, f3_checkBox, "") == 1){
f3_checkBox = (f3_checkBox == false) ? true: false;
if(f3_checkBox == true){
f3=1;
}else{
f3=0;
}
}
if(CheckBox(140,180, f4_checkBox, "") == 1){
f4_checkBox = (f4_checkBox == false) ? true: false;
if(f4_checkBox == true){
f4=1;
}else{
f4=0;
}
}
if(CheckBox(180,180, f5_checkBox, "") == 1){
f5_checkBox = (f5_checkBox == false) ? true: false;
if(f5_checkBox == true){
f5=1;
}else{
f5=0;
}
}
if(CheckBox(220,180, f6_checkBox, "") == 1){
f6_checkBox = (f6_checkBox == false) ? true: false;
if(f6_checkBox == true){
f6=1;
}else{
f6=0;
}
}
if(CheckBox(260,180, f7_checkBox, "") == 1){
f7_checkBox = (f7_checkBox == false) ? true: false;
if(f7_checkBox == true){
f7=1;
}else{
f7=0;
}
}
if(CheckBox(300,180, f8_checkBox, "") == 1){
f8_checkBox = (f8_checkBox == false) ? true: false;
if(f8_checkBox == true){
f8=1;
}else{
f8=0;
}
}
}
boolean checkBox_Getf1Flag(){
return f1_checkBox;
}
boolean checkBox_Getf2Flag(){
return f2_checkBox;
}
boolean checkBox_Getf3Flag(){
return f3_checkBox;
}
boolean checkBox_Getf4lag(){
return f4_checkBox;
}
boolean checkBox_Getf5Flag(){
return f5_checkBox;
}
boolean checkBox_Getf6Flag(){
return f6_checkBox;
}
boolean checkBox_Getf7Flag(){
return f7_checkBox;
}
boolean checkBox_Getf8lag(){
return f8_checkBox;
}
//舵機角度選擇
boolean g1_checkBox = false;
boolean g2_checkBox = false;
boolean g3_checkBox = false;
boolean g4_checkBox = false;
boolean g5_checkBox = false;
boolean g6_checkBox = false;
boolean g7_checkBox = false;
boolean g8_checkBox = false;
void CheckBoxHandle7(){
if(CheckBox(20,210,g1_checkBox, "")== 1){
g1_checkBox = (g1_checkBox == false) ? true: false;
if(g1_checkBox == true){
g1=1;
}else{
g1=0;
}
}
if(CheckBox(60,210,g2_checkBox, "") == 1){
g2_checkBox = (g2_checkBox == false) ? true: false;
if(g2_checkBox == true){
g2=1;
}else{
g2=0;
}
}
if(CheckBox(100,210, g3_checkBox, "") == 1){
g3_checkBox = (g3_checkBox == false) ? true: false;
if(g3_checkBox == true){
g3=1;
}else{
g3=0;
}
}
if(CheckBox(140,210, g4_checkBox, "") == 1){
g4_checkBox = (g4_checkBox == false) ? true: false;
if(g4_checkBox == true){
g4=1;
}else{
g4=0;
}
}
if(CheckBox(180,210, g5_checkBox, "") == 1){
g5_checkBox = (g5_checkBox == false) ? true: false;
if(g5_checkBox == true){
g5=1;
}else{
g5=0;
}
}
if(CheckBox(220,210, g6_checkBox, "") == 1){
g6_checkBox = (g6_checkBox == false) ? true: false;
if(g6_checkBox == true){
g6=1;
}else{
g6=0;
}
}
if(CheckBox(260,210, g7_checkBox, "") == 1){
g7_checkBox = (g7_checkBox == false) ? true: false;
if(g7_checkBox == true){
g7=1;
}else{
g7=0;
}
}
if(CheckBox(300,210, g8_checkBox, "") == 1){
g8_checkBox = (g8_checkBox == false) ? true: false;
if(g8_checkBox == true){
g8=1;
}else{
g8=0;
}
}
}
boolean checkBox_Getg1Flag(){
return g1_checkBox;
}
boolean checkBox_Getg2Flag(){
return g2_checkBox;
}
boolean checkBox_Getg3Flag(){
return g3_checkBox;
}
boolean checkBox_Getg4lag(){
return g4_checkBox;
}
boolean checkBox_Getg5Flag(){
return g5_checkBox;
}
boolean checkBox_Getg6Flag(){
return g6_checkBox;
}
boolean checkBox_Getg7Flag(){
return g7_checkBox;
}
boolean checkBox_Getg8lag(){
return g8_checkBox;
}
//舵機角度選擇
boolean h1_checkBox = false;
boolean h2_checkBox = false;
boolean h3_checkBox = false;
boolean h4_checkBox = false;
boolean h5_checkBox = false;
boolean h6_checkBox = false;
boolean h7_checkBox = false;
boolean h8_checkBox = false;
void CheckBoxHandle8(){
if(CheckBox(20,240,h1_checkBox, "")== 1){
h1_checkBox = (h1_checkBox == false) ? true: false;
if(h1_checkBox == true){
h1=1;
}else{
h1=0;
}
}
if(CheckBox(60,240,h2_checkBox, "") == 1){
h2_checkBox = (h2_checkBox == false) ? true: false;
if(h2_checkBox == true){
h2=1;
}else{
h2=0;
}
}
if(CheckBox(100,240, h3_checkBox, "") == 1){
h3_checkBox = (h3_checkBox == false) ? true: false;
if(h3_checkBox == true){
h3=1;
}else{
h3=0;
}
}
if(CheckBox(140,240, h4_checkBox, "") == 1){
h4_checkBox = (h4_checkBox == false) ? true: false;
if(h4_checkBox == true){
h4=1;
}else{
h4=0;
}
}
if(CheckBox(180,240, h5_checkBox, "") == 1){
h5_checkBox = (h5_checkBox == false) ? true: false;
if(h5_checkBox == true){
h5=1;
}else{
h5=0;
}
}
if(CheckBox(220,240, h6_checkBox, "") == 1){
h6_checkBox = (h6_checkBox == false) ? true: false;
if(h6_checkBox == true){
h6=1;
}else{
h6=0;
}
}
if(CheckBox(260,240, h7_checkBox, "") == 1){
h7_checkBox = (h7_checkBox == false) ? true: false;
if(h7_checkBox == true){
h7=1;
}else{
h7=0;
}
}
if(CheckBox(300,240, h8_checkBox, "") == 1){
h8_checkBox = (h8_checkBox == false) ? true: false;
if(h8_checkBox == true){
h8=1;
}else{
h8=0;
}
}
}
boolean checkBox_Geth1Flag(){
return h1_checkBox;
}
boolean checkBox_Geth2Flag(){
return h2_checkBox;
}
boolean checkBox_Geth3Flag(){
return h3_checkBox;
}
boolean checkBox_Geth4lag(){
return h4_checkBox;
}
boolean checkBox_Geth5Flag(){
return h5_checkBox;
}
boolean checkBox_Geth6Flag(){
return h6_checkBox;
}
boolean checkBox_Geth7Flag(){
return h7_checkBox;
}
boolean checkBox_Geth8lag(){
return h8_checkBox;
}
byte CheckBox(float x, float y, boolean sL, String str){
noFill();
//stroke(255,255,0);
if(sL){
fill(0,255,0);
}
rect(x, y, 22, 22);
textSize(16);
fill(0);
strokeWeight(2);
text(str, x + 30, y + 20);
if((mouseX > x) && (mouseY > y) && (mouseX < (x + 20) ) &&(mouseY < (y + 20))){
if (mousePressedFlag && (mouseButton == LEFT)) {
mousePressedFlag = false;
return 1;
}
}
return 0;
}
void Serial_SetClick()
{
click = 1;
}
復制代碼
作者:
jsntmyj
時間:
2019-4-6 15:48
認真向你學習!
歡迎光臨 (http://www.raoushi.com/bbs/)
Powered by Discuz! X3.1