我希望“pick_one”和“pick_all”按钮位于另一个称为“配置”按钮的通用按钮(如文件 - 或界面中的新页面)内。我在下面尝试了这段代码,但我得到了意外的令牌:无效错误。
有没有办法把按钮放在另一个按钮里面?
import controlP5.*; //import ControlP5 library
import processing.serial.*;
Serial port;
ControlP5 cp5; //create ControlP5 object
PFont font;
void setup(){ //Same as setup in arduino
size(900, 900);
port = new Serial(this, "COM4", 9600); //Change this to your port
cp5 = new ControlP5(this);
font = createFont ("Georgia Bold", 20);
cp5.addButton("PICK_ALL") //The button
.setPosition(100, 100) //x and y coordinates of upper left corner of button
.setSize(160, 150) //(width, height)
.setFont(font)
;
cp5.addButton("PICK_ONE") //The button
.setPosition(100, 400) //x and y coordinates of upper left corner of button
.setSize(160, 150) //(width, height)
.setFont(font)
;
cp5.addButton("CONFIGURATION") //The button
.setPosition(100, 400) //x and y coordinates of upper left corner of button
.setSize(160, 150) //(width, height)
.setFont(font)
;
}
void draw(){ //Same as loop in arduino
background(150, 0 , 150); //Background colour of window (r, g, b) or (0 to 255)
}
void CONFIGURATION() {
void PICK_ALL(){
port.write('t')
}
void PICK_ONE(){
port.write('l');
}}