Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
projektews2013:wwsr:start:wlangraph [2014/01/28 13:43] gorgotha |
projektews2013:wwsr:start:wlangraph [2016/01/21 12:45] (aktuell) |
||
---|---|---|---|
Zeile 9: | Zeile 9: | ||
boolean starten=false; | boolean starten=false; | ||
int start=99; | int start=99; | ||
+ | float winkel=0; | ||
+ | int wertezaehler=0; | ||
+ | float xPunkt=0; | ||
+ | float yPunkt=0; | ||
void setup () { | void setup () { | ||
Zeile 16: | Zeile 20: | ||
myPort = new Serial(this, portNames[portNames.length-1], 115200); | myPort = new Serial(this, portNames[portNames.length-1], 115200); | ||
- | size(400, 400); //X-Achse auf 180 begrenzt, da der Servo auch nur | + | size(600, 600); //X-Achse auf 180 begrenzt, da der Servo auch nur |
//bis 180° begrenzt ist. | //bis 180° begrenzt ist. | ||
background(0); | background(0); | ||
stroke(255); | stroke(255); | ||
+ | line(300, 300, 600, 300); | ||
| | ||
frameRate(2000); | frameRate(2000); | ||
+ | | ||
+ | for(int i=299;i<301;i++){ | ||
+ | point(299,i); | ||
+ | point(i,299); | ||
+ | } | ||
+ | for(int i=299;i<302;i++){ | ||
+ | point(i,301); | ||
+ | point(301,i); | ||
+ | } | ||
+ | for(int i=299;i<303;i++){ | ||
+ | point(i,302); | ||
+ | point(302,i); | ||
+ | } | ||
+ | |||
| | ||
} | } | ||
Zeile 32: | Zeile 51: | ||
} | } | ||
| | ||
- | | ||
- | | ||
for(int i=0;i<data.length;i++){ | for(int i=0;i<data.length;i++){ | ||
+ | | ||
if(starten==true){ | if(starten==true){ | ||
+ | if(xPunkt!=0 && yPunkt!=0){ | ||
+ | line(xPunkt, yPunkt, ((cos(radians(winkel))*((100+data[i])-35))*10)+300, ((sin(radians(winkel))*((100+data[i])-35))*10)+300); | ||
+ | } | ||
print(data[i]); | print(data[i]); | ||
print("\t"); | print("\t"); | ||
- | point(posX,varY-(varY-(abs((data[i]*4))))); | + | point(((cos(radians(winkel))*((100+data[i])-35))*10)+300,((sin(radians(winkel))*((100+data[i])-35))*10)+300); |
- | + | xPunkt=((cos(radians(winkel))*((100+data[i])-35))*10)+300; | |
- | if(nachRechts==true){ | + | yPunkt=((sin(radians(winkel))*((100+data[i])-35))*10)+300; |
- | posX++; | + | |
+ | | ||
+ | if(nachRechts==true && wertezaehler%4==0){ | ||
+ | winkel=winkel+0.9; | ||
} | } | ||
- | else{ | + | else if(nachRechts==false && wertezaehler%4==0){ |
- | posX--; | + | winkel=winkel-0.9; |
} | } | ||
- | if(posX==400){ | + | if(winkel==360){ |
nachRechts=false; | nachRechts=false; | ||
} | } | ||
- | if(posX==0){ | + | if(winkel==0){ |
nachRechts=true; | nachRechts=true; | ||
} | } | ||
} | } | ||
+ | wertezaehler++; | ||
if(data[i]==start){ | if(data[i]==start){ | ||
starten=true; | starten=true; | ||
Zeile 74: | Zeile 99: | ||
} | } | ||
} | } | ||
+ | |||
+ | |||
</file> | </file> |