Presentation is loading. Please wait.

Presentation is loading. Please wait.

Processing TYWu. Where can I download? 2.0b9 Windows 32-bit.

Similar presentations


Presentation on theme: "Processing TYWu. Where can I download? 2.0b9 Windows 32-bit."— Presentation transcript:

1 Processing TYWu

2 Where can I download? http://processing.org/download/ 2.0b9 Windows 32-bit

3 How to Install You'll have a.zip file. Double-click it, and drag the folder inside to a location on your hard disk. It could be Program Files or simply the desktop, but the important thing is for the processing folder to be pulled out of that.zip file. Then double-click processing.exe to start.

4 Getting Started Windows RUN STOP

5 Getting Started Function –ellipse(50, 50, 80, 80); This line of code means "draw an ellipse, with the center 50 pixels over from the left and 50 pixels down from the top, with a width and height of 80 pixels." Click the Run button, which looks like this:

6 Getting Started Example void setup() { size(480, 120); //Open a Display Window } void draw() { if (mousePressed) fill(0); else fill(255); ellipse(mouseX, mouseY, 80, 80); }

7 Getting Started Result

8 Communication Between Arduino and Processing By RS232 Serial.begin(9600); : Char Value; : Serial.write(Value); : import processing.serial.*; Serial serial; : serial = new Serial(this, "COM20", 9600); sensorValue = serial.read(); :

9 Communication Between Arduino and Processing Step 1 –Run Arduino Step 2 –Run Processing

10 Communication Between Arduino and Processing Example of Arduino int ultraAn = 0; int val = 0; char dist = 0; void setup() { Serial.begin(9600); } void loop() { val = analogRead(ultraAn); dist = (val*2.1)/3; Serial.write(dist); //Unit = 3cm delay (1000); // delays 1 secconds in between readings }

11 Communication Between Arduino and Processing Example of Processing import processing.serial.*; Serial serial; int sensorValue; void setup() { size(700, 200); serial = new Serial(this, "COM20", 9600); } void draw() { if ( serial.available() > 0) { sensorValue = serial.read(); println(sensorValue); background(255); fill(0,255,0); //Green rect(10, 95, sensorValue*3, 10); }

12 Communication Between Arduino and Processing Result

13 Function rect(a, b, c, d) a (float): x-coordinate of the rectangle by default b (float): y-coordinate of the rectangle by default c (float): width of the rectangle by default d (float): height of the rectangle by default

14 References http://processing.org/learning/gettingstarte d/http://processing.org/learning/gettingstarte d/ http://www.instructables.com/id/Arduino- to-Processing-Serial-Communication- withou/http://www.instructables.com/id/Arduino- to-Processing-Serial-Communication- withou/ http://www.processing.org/reference/rect_. htmlhttp://www.processing.org/reference/rect_. html http://coopermaa2nd.blogspot.tw/2011/03/ processing-arduino.htmlhttp://coopermaa2nd.blogspot.tw/2011/03/ processing-arduino.html


Download ppt "Processing TYWu. Where can I download? 2.0b9 Windows 32-bit."

Similar presentations


Ads by Google