It’s far from exciting, but I wrote my very first test program for the Arduino. Definitely easy! All it does is watch for finger-presses on the OLED, and then writes the location in text to the screen, and also places a pulsing (the central dot changes color rapidly and randomly) target wherever you touch (I haven’t calibrated the screen yet as you may have noticed), only redrawing when it needs to. I still have a lot to figure out, but it works!
Anyway, I’ll write something more substantial later, but this just shows how easy it is to get the Arduino up and running by someone who’s got no recent experience with microcontrollers.
Code for this is really easy:
void setup()
{
;
}
int oldmouseX;
int oldmouseY;
int tmouseX;
int tmouseY;
int r;
int g;
int b;
void loop()
{
gettouch();
tmouseX = mouseX;
tmouseY = mouseY;
if (tmouseX != oldmouseX || tmouseY != oldmouseY)
{
oldmouseX = mouseX;
oldmouseY = mouseY;
background(0);
fill(255, 0, 0);
ellipse(mouseX, mouseY, 20,20);
fill(225);
ellipse(mouseX, mouseY, 15,15);
fill(195);
ellipse(mouseX, mouseY, 10,10);
fill(165);
ellipse(mouseX, mouseY, 5,5);
fill(0);
text(oldmouseX, 10, 10);
text(oldmouseY, 10, 30);
delay(100);
}
else
{
r = random(128, 255);
g = random(128, 255);
b = random(128, 255);
fill(r, g, b);
ellipse(mouseX, mouseY, 5,5);
delay(50);
}
}