Proyecto Arduino Radar

Proyecto Arduino Radar En este tutorial de Arduino, te mostraré cómo puedes hacer que este radar de aspecto genial use l

Views 146 Downloads 3 File size 881KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

Proyecto Arduino Radar En este tutorial de Arduino, te mostraré cómo puedes hacer que este radar de aspecto genial use la placa Arduino y el entorno de desarrollo de procesamiento. Puede ver el siguiente video o leer el tutorial escrito a continuación para obtener más detalles.

Componentes necesarios para este Proyecto Arduino    

Sensor ultrasónico HC- SR04 ....... Servomotor ................................. Arduino Board ........................... Tablero y cables de salto ...

Construyendo el dispositivo 

Primero hice un soporte de cartón para conectar el sensor ultrasónico al Servo motor. Lo doblé como se muestra en la siguiente imagen, lo pegué y aseguré al servomotor con un tornillo como este.



También adjunté un encabezado de alfiler en el que soldé 4 cables de puente para conectar el sensor.



Finalmente aseguré el servo motor a la placa Arduino usando una banda elástica.

Esquema de circuito Conecté el sensor ultrasónico HC-SR04 a los pines número 10 y 11 y el servomotor al pin número 12 en la placa Arduino.

Códigos fuente Ahora necesitamos crear un código y subirlo a la Junta de Arduino que permitirá la interacción entre Arduino y el IDE de procesamiento. Para entender cómo funciona la conexión, haga clic aquí para visitar mi Tutorial de procesamiento y Arduino .

Aquí está el código fuente de Arduino con una descripción de cada línea del código (ESPAÑOL) 1. // Incluye la biblioteca Servo 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27.

#include . // Define los pines Tirg y Echo del sensor ultrasónico const int trigPin = 10 ; const int echoPin = 11 ; // Variables para la duración y la distancia larga duración; distancia int ; Servo myServo; // Crea un objeto servo para controlar el servomotor void setup ( ) { pinMode ( trigPin, OUTPUT ) ; // Establece el trigPin como salida pinMode ( echoPin, INPUT ) ; // Establece el echoPin como entrada De serie. comenzar ( 9600 ) ; myServo. adjuntar ( 12 ) ; // Define en qué pin está el servomotor conectado } void loop ( ) { // gira el servomotor de 15 a 165 grados para ( int i = 15 ; i 15 ; i-- ) { myServo. escribir ( i ) ; retraso ( 30 ) ; distance = calculateDistance ( ) ; De serie. imprimir ( i ) ; De serie. imprimir ( "," ) ; De serie. imprimir ( distancia ) ; De serie. imprimir ( "." ) ; } } // Función para calcular la distancia medida por el sensor ultrasónico int calculateDistance ( ) { digitalWrite ( trigPin, BAJO ) ; delayMicroseconds ( 2 ) ; // Establece el trigPin en estado ALTO durante 10 micro segundos digitalWrite ( trigPin, ALTO ) ; delayMicroseconds ( 10 ) ; digitalWrite ( trigPin, BAJO ) ; duration = pulseIn ( echoPin, HIGH ) ; // Lee el echoPin, devuelve el tiempo de viaje de la onda de sonido en microsegundos distancia = duración * 0 . 034 / 2 ; distancia de regreso ;

54. }

INGLES 1. // Includes the Servo library 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27.

#include . // Defines Tirg and Echo pins of the Ultrasonic Sensor const int trigPin = 10; const int echoPin = 11; // Variables for the duration and the distance long duration; int distance; Servo myServo; // Creates a servo object for controlling the servo motor void setup() { pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output pinMode(echoPin, INPUT); // Sets the echoPin as an Input Serial.begin(9600); myServo.attach(12); // Defines on which pin is the servo motor attached } void loop() { // rotates the servo motor from 15 to 165 degrees for(int i=15;i15;i--){ myServo.write(i); delay(30); distance = calculateDistance(); Serial.print(i); Serial.print(","); Serial.print(distance); Serial.print("."); } } // Function for calculating the distance measured by the Ultrasonic sensor int calculateDistance(){ digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); duration = pulseIn(echoPin, HIGH); // Reads the echoPin, returns the sound wave travel time in microseconds distance= duration*0.034/2; return distance;

54. }

Ahora recibiremos los valores para el ángulo y la distancia medida por el sensor desde la placa Arduino en el IDE de procesamiento usando la función SerialEvent () que lee los datos del puerto serial y vamos a poner los valores del ángulo y la distancia en las variables iAngle e iDistance. Esta variable se usará para dibujar el radar, las líneas, los objetos detectados y parte del texto.

Para dibujar el radar hice esta función drawRadar () que consiste en funciones de arco () y line () .

1. void drawRadar ( ) { 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

pushMatrix ( ) ; traducir ( 960 , 1000 ) ; // mueve las coordinadas iniciales a la nueva ubicación noFill ( ) ; strokeWeight ( 2 ) ; golpe ( 98 , 245 , 31 ) ; // dibuja las líneas de arco arco ( 0 , 0 , 1800 , 1800 , PI, TWO_PI ) ; arco ( 0 , 0 , 1400 , 1400 , PI, TWO_PI ) ; arco ( 0 , 0 , 1000 , 1000 , PI, TWO_PI ) ; arco ( 0 , 0 , 600 , 600 , PI, TWO_PI ) ; // dibuja las líneas de ángulo línea ( - 960 , 0 , 960 , 0 ) ; línea ( 0 , 0 , - 960 * cos ( radianes ( 30 ) ) , - 960 * sin ( radianes ( 30 ) ) ) ; línea ( 0 , 0 , - 960 * cos ( radianes ( 60 ) ) , - 960 * sin ( radianes ( 60 ) ) ) ; línea ( 0 , 0 , - 960 * cos ( radianes ( 90 ) ) , - 960 * sin ( radianes ( 90 ) ) ) ; línea ( 0 , 0 , - 960 * cos ( radianes ( 120 ) ) , - 960 * sin ( radianes ( 120 ) ) ) ; línea ( 0 , 0 , - 960 * cos ( radianes ( 150 ) ) , - 960 * sin ( radianes ( 150 ) ) ) ; línea ( - 960 * cos ( radianes ( 30 ) ) , 0 , 960 , 0 ) ; popMatrix ( ) ;

21. }

INGLES……………………………………………………………. 1. void drawRadar() { 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20.

pushMatrix(); translate(960,1000); // moves the starting coordinats to new location noFill(); strokeWeight(2); stroke(98,245,31); // draws the arc lines arc(0,0,1800,1800,PI,TWO_PI); arc(0,0,1400,1400,PI,TWO_PI); arc(0,0,1000,1000,PI,TWO_PI); arc(0,0,600,600,PI,TWO_PI); // draws the angle lines line(-960,0,960,0); line(0,0,-960*cos(radians(30)),-960*sin(radians(30))); line(0,0,-960*cos(radians(60)),-960*sin(radians(60))); line(0,0,-960*cos(radians(90)),-960*sin(radians(90))); line(0,0,-960*cos(radians(120)),-960*sin(radians(120))); line(0,0,-960*cos(radians(150)),-960*sin(radians(150))); line(-960*cos(radians(30)),0,960,0); popMatrix();

21. }

Para dibujar la línea que se mueve a lo largo del radar hice esta función drawLine () . Su centro de rotación se establece con la función translate () y utilizando la función de línea () en la que se utiliza la variable iAngle, la línea se vuelve a dibujar para cada grado. 1. void drawLine ( ) { 2. 3. 4. 5. 6. 7.

pushMatrix ( ) ; strokeWeight ( 9 ) ; golpe ( 30 , 250 , 60 ) ; traducir ( 960 , 1000 ) ; // mueve las coordinadas iniciales a la nueva ubicación line ( 0 , 0 , 950 * cos ( radianes ( iAngle ) ) , - 950 * sen ( radianes ( iAngle ) ) ) ; // dibuja la línea según el ángulo popMatrix ( ) ;

8. }

INGLES 1. void drawLine() { 2. 3. 4. 5. 6. 7.

pushMatrix(); strokeWeight(9); stroke(30,250,60); translate(960,1000); // moves the starting coordinats to new location line(0,0,950*cos(radians(iAngle)),-950*sin(radians(iAngle))); // draws the line according to the angle popMatrix();

8. }

Para dibujar los objetos detectados hice esta función drawObject () . Toma la distancia del sensor ultrasónico, lo transforma en píxeles y, en combinación con el ángulo del sensor, atrae el objeto en el radar. 1. void drawObject ( ) { 2. 3. 4. 5. 6. 7. 8. 9.

pushMatrix ( ) ; traducir ( 960 , 1000 ) ; // mueve las coordinadas iniciales a la nueva ubicación strokeWeight ( 9 ) ; golpe ( 255 , 10 , 10 ) ; // color rojo pixsDistance = iDistance * 22.5 ; // cubre la distancia desde el sensor de cm a píxeles // limitando el rango a 40 cms if ( iDistance < 40 ) { // dibuja el objeto según el ángulo y la distancia

10. line ( pixsDistance * cos ( radianes ( iAngle ) ) , -pixsDistance * sin ( radianes ( iAngle ) ) , 950 * cos ( radianes ( iAngle ) ) , - 950

* sin ( radianes ( iAngle ) ) ) ; 11. } 12. popMatrix ( ) ; 13. }

INGLES 1. void drawObject() { 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12.

pushMatrix(); translate(960,1000); // moves the starting coordinats to new location strokeWeight(9); stroke(255,10,10); // red color pixsDistance = iDistance*22.5; // covers the distance from the sensor from cm to pixels // limiting the range to 40 cms if(iDistance 40 ) { 106. noObject = "Fuera de rango" ; 107. } 108. else { 109. noObject = "Dentro del rango" ; 110. } 111. llenar ( 0 , 0 , 0 ) ; 112. noStroke ( ) ; 113. rect ( 0 , 1010 , ancho, 1080 ) ; 114. llenar ( 98 , 245 , 31 ) ; 115. textSize ( 25 ) ; 116. texto ( "10cm" , 1180 , 990 ) ; 117. texto ( "20cm" , 1380 , 990 ) ; 118. texto ( "30cm" , 1580 , 990 ) ; 119. texto ( "40cm" , 1780 , 990 ) ; 120. textSize ( 40 ) ; 121. texto ( "Objeto:" + noObject, 240 , 1050 ) ; 122. texto ( "Ángulo:" + iAngle + "°" , 1050 , 1050 ) ; 123. texto ( "Distancia:" , 1380 , 1050 ) ; 124. if ( iDistance < 40 ) { 125. texto ( "" + iDistance + "cm" , 1400 , 1050 ) ; 126. } 127. textSize ( 25 ) ; 128. llenar ( 98 , 245 , 60 ) ; 129. traducir ( 961 + 960 * cos ( radianes ( 30 ) ) , 982 - 960 * sin ( radianes ( 30 ) ) ) ; 130. rotar ( - radianes ( - 60 ) ) ; 131. texto ( "30 °" , 0 , 0 ) ; 132. resetMatrix ( ) ; 133. traducir ( 954 + 960 * cos ( radianes ( 60 ) ) , 984 - 960 * sin ( radianes ( 60 ) ) ) ; 134. rotar ( - radianes ( - 30 ) ) ;

135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148.

texto ( "60 °" , 0 , 0 ) ; resetMatrix ( ) ; traducir ( 945 + 960 * cos ( radianes ( 90 ) ) , 990 - 960 * sin ( radianes ( 90 ) ) ) ; rotar ( radianes ( 0 ) ) ; texto ( "90 °" , 0 , 0 ) ; resetMatrix ( ) ; traducir ( 935 + 960 * cos ( radianes ( 120 ) ) , 1003 - 960 * sin ( radianes ( 120 ) ) ) ; rotar ( radianes ( - 30 ) ) ; texto ( "120 °" , 0 , 0 ) ; resetMatrix ( ) ; traducir ( 940 + 960 * cos ( radianes ( 150 ) ) , 1018 - 960 * sin ( radianes ( 150 ) ) ) ; rotar ( radianes ( - 60 ) ) ; texto ( "150 °" , 0 , 0 ) ; popMatrix ( ) ;

149. }

INGLES 1. import processing.serial.*; // imports library for serial communication 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41.

import java.awt.event.KeyEvent; // imports library for reading the data from the serial port import java.io.IOException; Serial myPort; // defines Object Serial // defubes variables String angle=""; String distance=""; String data=""; String noObject; float pixsDistance; int iAngle, iDistance; int index1=0; int index2=0; PFont orcFont; void setup() { size (1920, 1080); smooth(); myPort = new Serial(this,"COM4", 9600); // starts the serial communication myPort.bufferUntil('.'); // reads the data from the serial port up to the character '.'. So actually it reads this: angle,distance. orcFont = loadFont("OCRAExtended-30.vlw"); } void draw() { fill(98,245,31); textFont(orcFont); // simulating motion blur and slow fade of the moving line noStroke(); fill(0,4); rect(0, 0, width, 1010); fill(98,245,31); // green color // calls the functions for drawing the radar drawRadar(); drawLine(); drawObject(); drawText(); }

42. 43. 44. 45. 46. 47. 48. 49.

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 50. 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 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98.

// converts the String variables into Integer iAngle = int(angle); iDistance = int(distance); } void drawRadar() { pushMatrix(); translate(960,1000); // moves the starting coordinats to new location noFill(); strokeWeight(2); stroke(98,245,31); // draws the arc lines arc(0,0,1800,1800,PI,TWO_PI); arc(0,0,1400,1400,PI,TWO_PI); arc(0,0,1000,1000,PI,TWO_PI); arc(0,0,600,600,PI,TWO_PI); // draws the angle lines line(-960,0,960,0); line(0,0,-960*cos(radians(30)),-960*sin(radians(30))); line(0,0,-960*cos(radians(60)),-960*sin(radians(60))); line(0,0,-960*cos(radians(90)),-960*sin(radians(90))); line(0,0,-960*cos(radians(120)),-960*sin(radians(120))); line(0,0,-960*cos(radians(150)),-960*sin(radians(150))); line(-960*cos(radians(30)),0,960,0); popMatrix(); } void drawObject() { pushMatrix(); translate(960,1000); // moves the starting coordinats to new location strokeWeight(9); stroke(255,10,10); // red color pixsDistance = iDistance*22.5; // covers the distance from the sensor from cm to pixels // limiting the range to 40 cms if(iDistance40) { 106. noObject = "Out of Range"; 107. } 108. else { 109. noObject = "In Range"; 110. } 111. fill(0,0,0); 112. noStroke(); 113. rect(0, 1010, width, 1080); 114. fill(98,245,31); 115. textSize(25); 116. text("10cm",1180,990); 117. text("20cm",1380,990); 118. text("30cm",1580,990); 119. text("40cm",1780,990); 120. textSize(40); 121. text("Object: " + noObject, 240, 1050); 122. text("Angle: " + iAngle +" °", 1050, 1050); 123. text("Distance: ", 1380, 1050); 124. if(iDistance 40 ) { noObject = "Fuera de rango" ; } else { noObject = "Dentro del rango" ; } llenar ( 0 , 0 , 0 ) ; noStroke ( ) ; rect ( 0 , altura-altura * 0.0648 , ancho, alto ) ; llenar ( 98 , 245 , 31 ) ; textSize ( 25 ) ;

texto ( "10cm" , ancho-ancho * 0. 3854 , alto-alto * 0.0833 ) ; texto ( "20cm" , ancho-ancho * 0 .281 , altura-alto * 0. 0833 ) ; texto ( "30cm" , ancho-ancho * 0.177 , altura-alto * 0. 0833 ) ; texto ( "40cm" , ancho-width * 0.0729 , la altura de la altura * 0 . 0833 ) ; textSize ( 40 ) ; texto ( "Objeto:" + noObjeto, ancho-ancho * 0.875 , alto-alto * 0.0277 ) ; texto ( "Ángulo:" + iAngulo + "°" , ancho-ancho * 0. 48 , altura-altura * 0.0277 ) ; texto ( "Distancia:" , ancho-ancho * 0.26 , altura-altura * 0. 0277 ) ; if ( iDistance < 40 ) { texto ( "" + iDistance + "cm" , ancho-width * 0 . 225 , la altura de la altura * 0. 0277 ) ; } textSize ( 25 ) ; llenar ( 98 , 245 , 60 ) ; traducir ( ( ancho-ancho * 0 .4994 ) + ancho / 2 * cos ( radianes ( 30 ) ) , ( altura-altura * 0 .0907 ) -ancho / 2 * sin ( radianes ( 30 ))); 141. rotar ( - radianes ( - 60 ) ) ; 142. texto ( "30 °" , 0 , 0 ) ; 143. resetMatrix ( ) ; 144. translate ( ( ancho-ancho * 0. 503 ) + ancho / 2 * cos ( radianes ( 60 ) ) , ( altura-altura * 0. 0888 ) -ancho / 2 * sin ( radianes ( 60 ))); 145. rotar ( - radianes ( - 30 ) ) ; 146. texto ( "60 °" , 0 , 0 ) ; 147. resetMatrix ( ) ; 148. traducir ( ( anchura-width * 0 0,507 ) + anchura / 2 * cos ( radianes ( 90 ) ) , ( altura de la altura * 0 . 0833 ) -width / 2 * sen ( radianes ( 90 ) ) ) ; 149. rotar ( radianes ( 0 ) ) ; 150. texto ( "90 °" , 0 , 0 ) ; 151. resetMatrix ( ) ; 152. traducir ( ancho-width * 0,513 + ancho / 2 * cos ( radianes ( 120 ) ) , ( altura de la altura * 0 . 07129 ) -width / 2 * sen ( radianes ( 120 ) ) ) ; 153. rotar ( radianes ( - 30 ) ) ; 154. texto ( "120 °" , 0 , 0 ) ; 155. resetMatrix ( ) ; 156. traducir ( ( anchura-width * 0 . 5104 ) + anchura / 2 * cos ( radianes ( 150 ) ) , ( altura de la altura * 0. 0574 ) -width / 2 * sen ( radianes ( 150 ) ) ) ; 157. rotar ( radianes ( - 60 ) ) ; 158. texto ( "150 °" , 0 , 0 ) ; 159. popMatrix ( ) ; 160. }

INGLES

1. /* Arduino Radar Project 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56.

* * Updated version. Fits any screen resolution! * Just change the values in the size() function, * with your screen resolution. * * by Dejan Nedelkovski, * www.HowToMechatronics.com * */ import processing.serial.*; // imports library for serial communication import java.awt.event.KeyEvent; // imports library for reading the data from the serial port import java.io.IOException; Serial myPort; // defines Object Serial // defubes variables String angle=""; String distance=""; String data=""; String noObject; float pixsDistance; int iAngle, iDistance; int index1=0; int index2=0; PFont orcFont; void setup() { size (1920, 1080); // ***CHANGE THIS TO YOUR SCREEN RESOLUTION*** smooth(); myPort = new Serial(this,"COM4", 9600); // starts the serial communication myPort.bufferUntil('.'); // reads the data from the serial port up to the character '.'. So actually it reads this: angle,distance. orcFont = loadFont("OCRAExtended-30.vlw"); } void draw() { fill(98,245,31); textFont(orcFont); // simulating motion blur and slow fade of the moving line noStroke(); fill(0,4); rect(0, 0, width, height-height*0.065); fill(98,245,31); // green color // calls the functions for drawing the radar drawRadar(); drawLine(); drawObject(); drawText(); } 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('.');

57. data = data.substring(0,data.length()-1); 58. 59. index1 = data.indexOf(","); // find the character ',' and puts it into the variable "index1" 60. 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 61. 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 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99.

// converts the String variables into Integer iAngle = int(angle); iDistance = int(distance); } void drawRadar() { pushMatrix(); translate(width/2,height-height*0.074); // moves the starting coordinats to new location noFill(); strokeWeight(2); stroke(98,245,31); // draws the arc lines arc(0,0,(width-width*0.0625),(width-width*0.0625),PI,TWO_PI); arc(0,0,(width-width*0.27),(width-width*0.27),PI,TWO_PI); arc(0,0,(width-width*0.479),(width-width*0.479),PI,TWO_PI); arc(0,0,(width-width*0.687),(width-width*0.687),PI,TWO_PI); // draws the angle lines line(-width/2,0,width/2,0); line(0,0,(-width/2)*cos(radians(30)),(-width/2)*sin(radians(30))); line(0,0,(-width/2)*cos(radians(60)),(-width/2)*sin(radians(60))); line(0,0,(-width/2)*cos(radians(90)),(-width/2)*sin(radians(90))); line(0,0,(-width/2)*cos(radians(120)),(-width/2)*sin(radians(120))); line(0,0,(-width/2)*cos(radians(150)),(-width/2)*sin(radians(150))); line((-width/2)*cos(radians(30)),0,width/2,0); popMatrix(); }

void drawObject() { pushMatrix(); translate(width/2,height-height*0.074); // moves the starting coordinats to new location strokeWeight(9); stroke(255,10,10); // red color pixsDistance = iDistance*((height-height*0.1666)*0.025); // covers the distance from the sensor from cm to pixels // limiting the range to 40 cms if(iDistance40) { noObject = "Out of Range"; } else { noObject = "In Range"; } fill(0,0,0); noStroke(); rect(0, height-height*0.0648, width, height); fill(98,245,31); textSize(25); 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); textSize(40); text("Object: " + noObject, width-width*0.875, height-height*0.0277); text("Angle: " + iAngle +" °", width-width*0.48, height-height*0.0277); text("Distance: ", width-width*0.26, height-height*0.0277); if(iDistance