Processing Code Radar
Processing Code Radar
* Twitter:
* https://twitter.com/AyadAhmedDjame1
* Facebook:
* https://www.facebook.com/Ayad.Ahmed.Djamel.14
* Instgram:
* https://www.instagram.com/ahmeed.djameel/
* Youtube Channel:
* https://www.youtube.com/channel/UCgguFsL_cabkYjlqS5dzG4w
*/
String angle="";
String distance="";
String data="";
float pixsDistance;
int iAngle, iDistance;
int index1=0;
void setup() {
size (1350, 695); //CHANGE THIS TO YOUR SCREEN RESOLUTION
smooth();
fill(0,12,255);
// simulating motion blur and slow fade of the moving line
noStroke();
fill(0,4);
rect(0, 0, width, height-height*0.065);
}
void serialEvent (Serial myPort) { // starts reading data from the Serial Port
// reads the data from the Serial Port up to the character '.' and puts it into
the String variable "data".
data = myPort.readStringUntil('.');
data = data.substring(0,data.length()-1);
index1 = data.indexOf(","); // find the character ',' and puts it into the
variable "index1"
angle= data.substring(0, index1); // read the data from position "0" to position
of the variable index1 or thats the value of the angle the Arduino Board sent into
the Serial Port
distance= data.substring(index1+1, data.length()); // read the data from position
"index1" to the end of the data pr thats the value of the distance
text("10cm",width-width*0.3854,height-height*0.0833);
text("20cm",width-width*0.281,height-height*0.0833);
text("30cm",width-width*0.177,height-height*0.0833);
text("40cm",width-width*0.0729,height-height*0.0833);
fill(255,255,10);
textSize(30);
text("Ayad Ahmed Djamel", 10, 50);
text("Angle: " + iAngle +" �", 950, height-height*0.0277);
if (iDistance<40){
textSize(25);
fill(0,12,255);
translate((width-width*0.4994)+width/2*cos(radians(30)),(height-height*0.0907)-
width/2*sin(radians(30)));
rotate(-radians(-60));
text("30�",0,0);
resetMatrix();
translate((width-width*0.503)+width/2*cos(radians(60)),(height-height*0.0888)-
width/2*sin(radians(60)));
rotate(-radians(-30));
text("60�",0,0);
resetMatrix();
translate((width-width*0.507)+width/2*cos(radians(90)),(height-height*0.0833)-
width/2*sin(radians(90)));
rotate(radians(0));
text("90�",0,0);
resetMatrix();
translate(width-width*0.513+width/2*cos(radians(120)),(height-height*0.07129)-
width/2*sin(radians(120)));
rotate(radians(-30));
text("120�",0,0);
resetMatrix();
translate((width-width*0.5104)+width/2*cos(radians(150)),(height-height*0.0574)-
width/2*sin(radians(150)));
rotate(radians(-60));
text("150�",0,0);
popMatrix();
}