When button clicked, let something move

edited May 2017 in Arduino

So i build something so that when you push a button, an LED is going to light up

Now the issue that I'm having is that when i click the button, it doesn't do anything

this is my code in processing

import processing.serial.*;
import cc.arduino.*;

Arduino arduino;
int BUTTON1 = 11;
int BUTTON2 = 10;
int BUTTON3 = 9;
int BUTTON4 = 8; 


void setup() 
{
  size(600, 600);
arduino = new Arduino(this, Arduino.list()[0], 57600);


}

void draw()
{   
  int x = 150;
  int y = 150;
  ellipse(x,y,50,50);
   if(arduino.digitalRead(BUTTON1) == Arduino.HIGH) {
     x = x + 50;
   }
}

I hope that someon can help me

Answers

Sign In or Register to comment.