Quantcast
Channel: Arduino - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 747

When button clicked, let something move

$
0
0

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


Viewing all articles
Browse latest Browse all 747

Latest Images

Trending Articles



Latest Images