Hello Alll,
Newbie programmer here (just learning the ropes). I’m trying to create a dash for a boat which runs off arduino. I’m trying to make the UI right now.I need to limit the rotation of my indicator. The indicator is a circle that rotates around the center. Below is the code I have so far. eventually the gauge will be controlled by a crankshaft sensor via the arduino.
PImage needle; // to store meter needle image
PImage meter; // to store meter image
PImage multi; //multigauge
float counter; //for roatation of needle
void setup()
{
counter=0.0; //Controls rotation
size(1366,768); //output window size 1366 x 768 pixel
needle=loadImage("semicircleindicator.png"); //loading ndl.png image to needle
meter=loadImage("gauge2.png"); //loading meter.jpg image to meter
multi=loadImage("MULTIGUAGE.png"); //multiguage
multi.resize(500,400); //resize the multiguage
}
void draw()
{
background(0); //making background color as black
pushMatrix(); //sets an independent opject from the rest of the group
counter++;
translate(width/2, height/2);
rotate(counter*TWO_PI/360);
translate(-needle.width/2, -needle.height/2);
image(needle,0,0);
popMatrix();
image(meter, (width/4)+25, (height/2)-499); //drawing meter image
image(multi, (width/2)+180, (height/2)-290);//draws mutiguage
}