Need help with an Arduino program

here it is

int circleX, circleY;  
int circleSize = 93;   
color  circleColor, baseColor;
color circleHighlight;
color currentColor;
color circleColour;
boolean circleOver = false;



void setup() {
  size(640, 360);
  circleColor = color(255);
  circleColour = color(0);
  circleHighlight = color(204);
  baseColor = color(0);
  currentColor = baseColor;
  circleX = width/2+circleSize/2+10;
  circleY = height/2;
  ellipseMode(CENTER);
  textAlign(CENTER, CENTER);
  textSize(20);
}

boolean ledOn = false;
void draw() {
  background(currentColor);
  fill(ledOn ? color(255, 0, 0): color(255));
  ellipse(100, 100, circleSize, circleSize);
  fill(255);
  ellipse(circleX, circleY, circleSize, circleSize);
  fill(0);

  text(ledOn ? "ON" : "OFF", circleX, circleY);
}

void mousePressed() {
  if (overCircle(circleX, circleY, circleSize) && mousePressed) {
    ledOn = !ledOn;
  }
}

boolean overCircle(int x, int y, int diameter) {
  float disX = x - mouseX;
  float disY = y - mouseY;
  if (sqrt(sq(disX) + sq(disY)) < diameter/2 ) {
    return true;
  } else {
    return false;
  }
}

2 Likes