Hi guys,

This is my first post here, hope it’s not too noobish.

I am trying to turn this processing sketch arduino compatible, but I can’t find the right way. I’d like to control the R and X letters with the 2 buttons connected to my breadboard.

This is how I imagine the solution: if I press down the button connected to pin one, it switches to HIGH and creates the same effect as I was pressing down the key, R. - the same with my other button.

here is the code:

```
import toxi.geom.*;
import toxi.geom.mesh2d.*;
// empty voronoi mesh container
Voronoi voronoi = new Voronoi();
// switches
boolean doShowPoints=false;
boolean doShowDelaunay;
boolean doShowHelp=false;
void setup() {
size(600, 600);
smooth();
}
void draw() {
background(255);
stroke(0);
noFill();
// draw delaunay triangulation
if (doShowDelaunay) {
stroke(0, 0, 255, 50);
beginShape(TRIANGLES);
for (Triangle2D t : voronoi.getTriangles()) {
triangle(t.a.x, t.a.y, t.b.x, t.b.y, t.c.x, t.c.y);
}
endShape();
}else {
// draw all voronoi polygons, clip them if needed...
for (Polygon2D poly : voronoi.getRegions()) {
beginShape();
for(Vec2D vector : poly.vertices){
vertex(vector.x,vector.y);
}
endShape(CLOSE);
}
}
// draw original points added to voronoi
if (doShowPoints) {
fill(255, 0, 255);
noStroke();
for (Vec2D c : voronoi.getSites()) {
ellipse(c.x, c.y, 5, 5);
}
}
}
void keyPressed() {
switch(key) {
case 'x':
voronoi = new Voronoi();
break;
case 'r':
for (int i = 0; i < 10; i++) {
voronoi.addPoint(new Vec2D(random(width), random(height)));
}
break;
}
}
```

thanks for you help