Benutzer-Werkzeuge

Webseiten-Werkzeuge


skript:arduinoradar

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
skript:arduinoradar [2016/08/03 15:29]
c.jaedicke
skript:arduinoradar [2016/08/03 17:39] (aktuell)
c.jaedicke [Etwas zeichnen mit Processing]
Zeile 1: Zeile 1:
 ===== Das Arduino Radar ===== ===== Das Arduino Radar =====
 +In drei Teams wird der Bau des Radars vorbereitet: ​
 +  - Ultraschall-Sensor (HC-SR04)
 +  - Infrarot-Sensor (Sharp GP2D12)
 +  - Servo-Aktuator (Blue Bird)
  
-=== Etwas zeichnen mit Processing ===+Schaut im Internet wie ihr die Sensoren bzw. Aktuatoren an den Arduino anschließen könnt. Sobald ihr die Messdaten in einer sinnvollen [[https://​de.wikipedia.org/​wiki/​Internationales_Einheitensystem#​SI-Basiseinheiten|SI-Einheit]] auf dem Seriellen Monitor ausgeben könnt bzw. den Servo auf beliebige Positionen steuern könnt, widmet ihr euch dem Datenaustausch zwischen Arduino und Processing. Weitere Aufgaben sind: 
 +  * Montieren der Sensoren auf dem Servo 
 +  * Visualisierung der Daten in Processing 
 +==== Etwas zeichnen mit Processing ​====
 Einfache grafische Elemente mit Processing darstellen, ein Beispiel: Einfache grafische Elemente mit Processing darstellen, ein Beispiel:
  
 <code java> <code java>
-int tickRadius; //radius of the ticks +int x;
-int handPos; //position of the hand in degree +
-//window origin in the upper left corner +
-int x_M; //window center in x-direction +
-int y_M//window center in y-direction +
  
 void setup() { void setup() {
   //window size in pixel   //window size in pixel
   size(700,​500);​   size(700,​500);​
-  ​tickRadius = 200; +  ​= 0;
-  handPos ​= 0+
-  x_M = width/2; +
-  y_M = height/2;+
 } }
  
 void draw() { void draw() {
-  ​drawBackground();​ +  //draws point in the window 
-  drawCenter();​ +  ​point(xheight/4); 
-  drawTicks();​ +  //draws line 
-  handPos = drawHand(handPos);​ +  ​line(xheight/2, x-10height/4 - 40); 
-+  //draws a circle 
- +  ​ellipse(x, height/41010); 
-void drawBackground() { +  //every 10px 
-  ​// Using only one value with color() +  ​x+=10;
-  // generates ​grayscale value. +
-  ​color c = color(65);  // Define '​c'​ with grayscale value +
-  background(c); ​ // '​c'​ as background color +
-+
- +
-void drawCenter() { +
-  color c = color(255204, 0);  ​// Define RGB color '​c'​ +
-  fill(c);  // Use color variable '​c'​ as fill color +
-  ​noStroke(); ​ // ​Don't draw stroke around shapes +
-  ​ellipse(x_My_M, 40, 40);  ​// Draw left circle +
-+
- +
-void drawTicks() { +
-  color c = color(255204, 0);  // Define RGB color '​c'​ +
-  stroke(c);​ +
-  for(int i = 0; i < 360; i+=4){ +
-    // = r * cos(phi)y = r sin(phi) +
-    ​// use radian measure +
-    point(x_M + tickRadius * cos(PI/​180*i),​ y_M + tickRadius * sin(PI/​180*i)); +
-  } +
- +
-+
- +
-int drawHand(int handPos) { +
-  color c = color(255, 204, 0);  // ​Define RGB color '​c'​ +
-  ​stroke(c); +
-  // = r * cos(phi)y = r sin(phi) +
-  ​// use radian measure +
-  line(x_My_Mx_M + tickRadius * cos(PI/​180*handPos),​ y_M + tickRadius * sin(PI/​180*handPos)); +
-  // update handPos by one degree +
-  ​handPos++; +
-  return handPos;+
 } }
 </​code>​ </​code>​
- +==== Daten vom Arduino mit Processing empfangen ​==== 
-=== Daten vom Arduino mit Processing empfangen === +[[http://​www.mintgruen.tu-berlin.de/​robotikWiki/​doku.php?​id=techniken:​datenaustausch:​processingserialread|Datenaustausch ​mit Processing]]
-[[techniken:​datenaustausch|Datenaustausch ​zwischen Arduino und Computer]]+
skript/arduinoradar.1470230963.txt.gz · Zuletzt geändert: 2016/08/03 15:29 von c.jaedicke