Real Time Data Plotting

Size: px
Start display at page:

Download "Real Time Data Plotting"

Transcription

1 Real Time Data Plotting

2 Introduction This lesson will show how to write a program plot data on a X-Y graph. On the Arduino, write a program to sample a sensor and print the voltage to the Serial interface. Send the sample once a second. The plotting program will read the data from the serial interface and plot it. This plotting program will plot the data in real time. It will display 400 samples along the X axis and then repeat over writing the previous samples.

3 The Plot The plot is going to be made in a rectangle. The top left corner of the rectangle will be positioned at 50,50 pixel location. The rectangle will be 400 by 400 pixels. X and Y labels will be added along with tick marks. Data will be plotted inside the rectangle.

4 First, two variables will be declared. Declaring them outside any function will make them global meaning they can be used in any function. Variable integer i will be an index variable. Variable data_plot will be an floating point array of 400 elements. int i; int[] data_plot = new int[400];

5 Next is the setup() function. The window is created with the size() function. All the elements in the data_plot array are initialized to zero. Variables always need to be initialized. Since the variable i was used, it has to be reset to zero. After the for() loop, the variable i has a value of 400. int i; float[] data_plot = new float[400]; void setup() size(500,500); for(i=0;i<400;i++) data_plot[i] = 0.0; i = 0;

6 Last item is to set the text size in the plot. This isn't required and can be changed depending on the desired look of the plot. int i; float[] data_plot = new float[400]; void setup() size(500,500); for(i=0;i<400;i++) data_plot[i] = 0.0; i = 0; textsize(14);

7 Two functions are created. The plot_data() function will generate the plot with the values in the data_plot variable array. The draw() function repeatedly calls the plot_data() function. Before it is called, the background() function is called. The background() function clears the screen so the plot can be redrawn with new data. If it is not called, the display will just have plots placed on top of plots. int i; float[] data_plot = new float[400]; void setup() size(500,500); for(i=0;i<400;i++) data_plot[i] = 0.0; i = 0; textsize(14); void draw() background(0); plot_data();

8 In the plot_data() function, the fill color is set to a dark gray which will set the color of the rectangle. The rect() function draws the rectangle starting at pixel 50,50 with a size of 400 by 400 pixels. Remember the starting position of the rectangle. The 50,50 coordinate will be the offset for drawing in the rectangle. int i; float[] data_plot = new float[400]; void setup() size(500,500); for(i=0;i<400;i++) data_plot[i] = 0.0; i = 0; textsize(14); void draw() background(0); plot_data();

9 The program can be run now. It will open a window and draw a rectangle on a black window that is dark grey. From now on, each step will add to the plot. The program can be run each time to see what was added. The setup() function and the draw() function will not be shown to save space. int i; float[] data_plot = new float[400]; void setup() size(500,500); for(i=0;i<400;i++) data_plot[i] = 0.0; i = 0; textsize(14); void draw() background(0); plot_data();

10 Import the Serial library. Create an instance of Serial called port. In the setup function, open the serial connection. Change the COM port number as needed. import processing.serial.*; Serial port; int i; float[] data_plot = new float[400]; void setup() port = new Serial(this, COM3,9600); size(500,500); for(i=0;i<400;i++) data_plot[i] = 0.0; i = 0; textsize(14); void draw() background(0); plot_data();

11 This section of code checks if the serial port had data in its buffer. If data is available, it is read into the String variable a. The String variable a is checked to make sure it is not empty. If it is not empty, the data is processed. First the variable a has the carriage return and linefeed characters removed. It is then converted to a floating point number and stored in the data_plot array at the element pointed to by i. i is incremented an checked to make sure it does not reach 400. When it does, it is reset to 0. //Previous code not shown for space void draw() background(0); if(port.available() > 0) String a = port.readstringuntil(10); if(a!= null) a = a.replaceall( (\\r \\n), ); data_plot[i] = float.parsefloat(a); i++; if(i == 400) i = 0; plot_data();

12 The two new functions inserted to modify how the rectangle is drawn. strokeweight() sets the line thickness. stroke() sets the color which is white. // only the plot function shown here strokeweight(4); stroke(255);

13 A label is added to the X axis. strokeweight(4); stroke(255); text( X Axis,250,480);

14 The next addition is adding the Y axis label. The label is rotated and moved into position. The translate() function moves the coordinate system. The rotate() function rotates the coordinate system. The text() function for the y Axis is then rendered. In order to not have everything else rotated and translated, the reverse rotation and translation is executed. strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250);

15 Now, the data is plotted. First, the plot color is set to purple. The line thickness is set to 1. strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250); stroke(200,0,200); strokeweight(1);

16 This section draws the data plot. First, the beginshape() function is called. This indicates the start of vector drawing. The parameter makes a line drawn between vector coordinates. The for() loop sequences through the data_plot array and creates a line to each coordinate specified in the vertex() function. When plotting the data is completed, the function endshape() is called. Setting Up the Plot strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250); stroke(200,0,200); strokeweight(1); beginshape(lines); for(int b = 0;b < 400;b++) int y =map(data_plot[b],0,1023,400,0); vertex(b+50,y); endshape();

17 The map() function is used to scale the data to fit within the rectangle area that is being used as the plot. The height of the rectangle is 400 pixels. The data, if it is analog data has a range of 0 to The map function will scale the analog data to the range of 400 to 0. Notice the 400 is before 0. This inverts the data plot since the screen coordinates start at the top left corner. strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250); stroke(200,0,200); strokeweight(1); beginshape(lines); for(int b = 0;b < 400;b++) int y =map(data_plot[b],0,1023,400,0); vertex(b+50,y+50); endshape();

18 Notice in the vertex() function that 50 is added to the x coordinate. This is because the rectangle at the 50 x coordinate. 50 is also added to the Y coordinate for the same reason. You have to take in into account the position of the rectangle. Run the program and have the arduino processor board send data from the analog port with a sensor connected. Use the serial.println() function to send the data. strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250); stroke(200,0,200); strokeweight(1); beginshape(lines); for(int b = 0;b < 400;b++) int y =map(data_plot[b],0,1023,400,0); vertex(b+50,250 data_plot[b]); endshape();

19 Notice in the vertex() function that 50 is added to the x coordinate. This is because the rectangle at the 50 x coordinate. 50 is also added to the Y coordinate for the same reason. You have to take in into account the position of the rectangle. Run the program and have the arduino processor board send data from the analog port with a sensor connected. Use the serial.println() function to send the data. strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250); stroke(200,0,200); strokeweight(1); beginshape(lines); for(int b = 0;b < 400;b++) int y =map(data_plot[b],0,1023,400,0); vertex(b+50,250 data_plot[b]); endshape();

20 It is time to add more features. The for() loop inserted adds tick marks along both axis on the plot. The tick marks are separated by 50 pixels and are 5 pixels long. The X axis tick marks are labelled with the text statement. strokeweight(4); stroke(255); line(50,250,400,250); text( X Axis,250,480); translate(20,250); rotate( PI/2); text("y axis",0,0); rotate(pi/2); translate( 20, 250); for(int x=0;x<400;x = x + 50) text(x,x+50,465); line(x+50,445,x+50,450); line(50,x+50,55,x+50); stroke(200,0,200); strokeweight(1); beginshape(lines); for(int b = 0;b < 400;b++) int y =map(data_plot[b],0,1023,400,0); vertex(b+51,data_plot[b] + 251); endshape();

21 This lesson showed the basics of creating a plot and filling it with data. Done More can be done with the plot. The tick marks can be labelled with values. The tick marks can be extended to create a grid. The window can be made larger and a second plot added to plot more data.

Introduction to Processing

Introduction to Processing Processing Introduction to Processing Processing is a programming environment that makes writing programs easier. It contains libraries and functions that make interacting with the program simple. The

More information

Transform 1: Translate, Matrices

Transform 1: Translate, Matrices Transform 1: Translate, Matrices This unit introduces coordinate system transformations and explains how to control their scope. Syntax introduced: translate(), pushmatrix(), popmatrix() The coordinate

More information

EXAMINATIONS 2016 TRIMESTER 2

EXAMINATIONS 2016 TRIMESTER 2 EXAMINATIONS 2016 TRIMESTER 2 CGRA 151 INTRODUCTION TO COMPUTER GRAPHICS Time Allowed: TWO HOURS CLOSED BOOK Permitted materials: Silent non-programmable calculators or silent programmable calculators

More information

EXAMINATIONS 2017 TRIMESTER 2

EXAMINATIONS 2017 TRIMESTER 2 EXAMINATIONS 2017 TRIMESTER 2 CGRA 151 INTRODUCTION TO COMPUTER GRAPHICS Time Allowed: TWO HOURS CLOSED BOOK Permitted materials: Silent non-programmable calculators or silent programmable calculators

More information

CS110 Introduction to Computing Fall 2016 Practice Exam 1 -- Solutions

CS110 Introduction to Computing Fall 2016 Practice Exam 1 -- Solutions CS110 Introduction to Computing Fall 2016 Practice Exam 1 -- Solutions The exam will be closed-note and closed-book; please consider this fact before using your notes on this practice version. Please see

More information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

Sten-SLATE ESP. Graphical Interface

Sten-SLATE ESP. Graphical Interface Sten-SLATE ESP Graphical Interface Stensat Group LLC, Copyright 2016 1 References www.arduino.cc http://esp8266.github.io/arduino/versions/2.1.0/doc/reference.html 2 Graphical Interface In this section,

More information

Review Cellular Automata The Game of Life. 2D arrays, 3D arrays. Review Array Problems Challenge

Review Cellular Automata The Game of Life. 2D arrays, 3D arrays. Review Array Problems Challenge Review Cellular Automata The Game of Life 2D arrays, 3D arrays Review Array Problems Challenge example1.pde Up until now All movement and sizing of graphical objects have been accomplished by modifying

More information

Iteration in Programming

Iteration in Programming Iteration in Programming for loops Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list There are three types of loop in programming: While

More information

Question 1 (10 points) Write the correct answer in each of the following: a) Write a Processing command to create a canvas of 400x300 pixels:

Question 1 (10 points) Write the correct answer in each of the following: a) Write a Processing command to create a canvas of 400x300 pixels: Question 1 (10 points) Write the correct answer in each of the following: a) Write a Processing command to create a canvas of 400x300 pixels: size(400, 300); b) After the above command is carried out,

More information

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 10: DIGITAL COMPASS DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS OVERVIEW This is a breakout board for Honeywell's

More information

To specify the dimensions of the drawing canvas use the size statement: ! size( 300, 400 );

To specify the dimensions of the drawing canvas use the size statement: ! size( 300, 400 ); Study Guide We have examined three main topics: drawing static pictures, drawing simple moving pictures, and manipulating images. The Final Exam will be concerned with each of these three topics. Each

More information

SERIAL COMMUNICATION. _creates a data stream by sending one bit at a me _occurs sequen ally H...E...L...L...O

SERIAL COMMUNICATION. _creates a data stream by sending one bit at a me _occurs sequen ally H...E...L...L...O SERIAL COMMUNICATION Bits, Bytes, Data Rates and Protocols ASCI interpreta on Using terminal to view serial Data Serial Out from Arduino Serial In to Processing SERIAL COMMUNICATION _creates a data stream

More information

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE

EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE EGG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 11: DIGITAL COMPASS DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS OVERVIEW This is a breakout board for Honeywell's

More information

We will start our journey into Processing with creating static images using commands available in Processing:

We will start our journey into Processing with creating static images using commands available in Processing: Processing Notes Chapter 1: Starting Out We will start our journey into Processing with creating static images using commands available in Processing: rect( ) line ( ) ellipse() triangle() NOTE: to find

More information

Graphics. HCID 520 User Interface Software & Technology

Graphics. HCID 520 User Interface Software & Technology Graphics HCID 520 User Interface Software & Technology PIXELS! 2D Graphics 2D Graphics in HTML 5 Raster Graphics: canvas element Low-level; modify a 2D grid of pixels.

More information

Graphics. HCID 520 User Interface Software & Technology

Graphics. HCID 520 User Interface Software & Technology Graphics HCID 520 User Interface Software & Technology PIXELS! 2D Graphics 2D Raster Graphics Model Drawing canvas with own coordinate system. Origin at top-left, increasing down and right. Graphics

More information

Processing Transformations. Affine Transformations

Processing Transformations. Affine Transformations Processing Transformations Affine Transformations 1 A house size(200, 200); rect(50, 75, 100, 75); // (left, top, w, h) rect(100, 110, 20, 40); // door rect(70, 110, 15, 15); //window triangle(50, 75,

More information

Arduino. AS220 Workshop. Part III Multimedia Applications Lutz Hamel

Arduino. AS220 Workshop. Part III Multimedia Applications Lutz Hamel AS220 Workshop Part III Multimedia Applications Lutz Hamel hamel@cs.uri.edu www.cs.uri.edu/~hamel/as220 Basic Building Blocks The basic building blocks for Arduino interactive object(s) are: Digital Input

More information

Old 257 Exam #2s for Practice

Old 257 Exam #2s for Practice Old Exam #2s 257/757 Exploring Programming with Graphics Page 1 Old 257 Exam #2s for Practice Exams will be taken on Thursday March 27 in the cluster. You will have the entire class time to do the exam.

More information

mith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut

mith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut mith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Important Review Does the animation leave a trace? Are the moving objects move without a

More information

CISC 1600 Lecture 3.1 Introduction to Processing

CISC 1600 Lecture 3.1 Introduction to Processing CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists

More information

Design Programming DECO2011

Design Programming DECO2011 Design Programming DECO2011 Rob Saunders web: http://www.arch.usyd.edu.au/~rob e-mail: rob@arch.usyd.edu.au office: Room 274, Wilkinson Building Data, Variables and Flow Control What is a Variable? Computers

More information

CSE120 Wi18 Final Review

CSE120 Wi18 Final Review CSE120 Wi18 Final Review Practice Question Solutions 1. True or false? Looping is necessary for complex programs. Briefly explain. False. Many loops can be explicitly written out as individual statements

More information

Building a GUI From Scratch

Building a GUI From Scratch Building a GUI From Scratch 1 Processing Graphical User Interface In this lesson, you will learn how to create some simple GUI objects to control the robot. The GUI objects will be sliders and a joystick.

More information

Interaction Design A.A. 2017/2018

Interaction Design A.A. 2017/2018 Corso di Laurea Magistrale in Design, Comunicazione Visiva e Multimediale - Sapienza Università di Roma Interaction Design A.A. 2017/2018 7 Conditionals in Processing Francesco Leotta, Andrea Marrella

More information

CISC 1600, Lab 3.1: Processing

CISC 1600, Lab 3.1: Processing CISC 1600, Lab 3.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1. Go to https://www.openprocessing.org/class/57767/

More information

Using Methods. Methods that handle events. Mairead Meagher Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics

Using Methods. Methods that handle events. Mairead Meagher Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics Using Methods Methods that handle events Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Caveat The term function is used in Processing e.g. line(),

More information

CS110 Introduction to Computing Fall 2016 Practice Exam 1

CS110 Introduction to Computing Fall 2016 Practice Exam 1 CS110 Introduction to Computing Fall 2016 Practice Exam 1 The exam will be closed-note and closed-book; please consider this fact before using your notes on this practice version. Please see the abbreviated

More information

Lecture 7. Processing Development Environment (or PDE)

Lecture 7. Processing Development Environment (or PDE) Lecture 7 Processing Development Environment (or PDE) Processing Class Overview What is Processing? Installation and Intro. Serial Comm. from Arduino to Processing Drawing a dot & controlling position

More information

2D Shapes. Creative Coding & Generative Art in Processing 2 Ira Greenberg, Dianna Xu, Deepak Kumar

2D Shapes. Creative Coding & Generative Art in Processing 2 Ira Greenberg, Dianna Xu, Deepak Kumar 2D Shapes Creative Coding & Generative Art in Processing 2 Ira Greenberg, Dianna Xu, Deepak Kumar Did you do this? Read Chapter 2 (pages 33-50) Read and do the Coordinate Systems & Shapes and Color tutorials

More information

CISC 1600, Lab 2.1: Processing

CISC 1600, Lab 2.1: Processing CISC 1600, Lab 2.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using Sketchpad, a site for building processing sketches online using processing.js. 1.1. Go to http://cisc1600.sketchpad.cc

More information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

Using Methods. More on writing methods. Dr. Siobhán Drohan Mairead Meagher. Produced by: Department of Computing and Mathematics

Using Methods. More on writing methods. Dr. Siobhán Drohan Mairead Meagher. Produced by: Department of Computing and Mathematics Using Methods More on writing methods Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topics list Method example: Eyes Method example: X s Overloading

More information

GRAPHICS PROGRAMMING. LAB #3 Starting a Simple Vector Animation

GRAPHICS PROGRAMMING. LAB #3 Starting a Simple Vector Animation GRAPHICS PROGRAMMING LAB #3 Starting a Simple Vector Animation Introduction: In previous classes we have talked about the difference between vector and bitmap images and vector and bitmap animations. In

More information

import processing.serial.*; //import the Serial library import controlp5.*; Serial myport; //the Serial port object

import processing.serial.*; //import the Serial library import controlp5.*; Serial myport; //the Serial port object import processing.serial.*; //import the Serial library import controlp5.*; Serial myport; //the Serial port object ControlP5 cp5; //the Control object CheckBox checkbox; Chart mychart; //Initialize Variables

More information

This Week Assignment 1 Arrays Time Casting Reading code Project 1

This Week Assignment 1 Arrays Time Casting Reading code Project 1 Computation as an Expressive Medium Lab 2: Kindergarten Cubbies, Back to the Future and Lego Mania Joshua Cuneo This Week Assignment 1 Arrays Time Casting Reading code Project 1 Assignment 1 A1-01: Draw

More information

CISC 1600, Lab 2.3: Processing animation, objects, and arrays

CISC 1600, Lab 2.3: Processing animation, objects, and arrays CISC 1600, Lab 2.3: Processing animation, objects, and arrays Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad. sketchpad.cc in your browser and log in. Go to http://cisc1600.

More information

Interaction Design A.A. 2017/2018

Interaction Design A.A. 2017/2018 Corso di Laurea Magistrale in Design, Comunicazione Visiva e Multimediale - Sapienza Università di Roma Interaction Design A.A. 2017/2018 8 Loops and Arrays in Processing Francesco Leotta, Andrea Marrella

More information

Chapter 2 Surfer Tutorial

Chapter 2 Surfer Tutorial Chapter 2 Surfer Tutorial Overview This tutorial introduces you to some of Surfer s features and shows you the steps to take to produce maps. In addition, the tutorial will help previous Surfer users learn

More information

DEC HEX ACTION EXTRA DESCRIPTION

DEC HEX ACTION EXTRA DESCRIPTION PHRAGSOFT 128 X 64 PIXEL LCD DISPLAY DRIVER The display driver uses the equivalent of standard BBC Microcomputer VDU codes, however, because the display is monochrome, with a fixed resolution, there are

More information

CISC 1600, Lab 2.2: Interactivity in Processing

CISC 1600, Lab 2.2: Interactivity in Processing CISC 1600, Lab 2.2: Interactivity in Processing Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad, a site for building processing sketches online using processing.js.

More information

Graphics: Legacy Library

Graphics: Legacy Library Graphics: Legacy Library Version 5.1 February 14, 2011 (require graphics/graphics) The viewport graphics library is a relatively simple toolbox of graphics commands. The library is not very powerful; it

More information

Connecting Arduino to Processing a

Connecting Arduino to Processing a Connecting Arduino to Processing a learn.sparkfun.com tutorial Available online at: http://sfe.io/t69 Contents Introduction From Arduino......to Processing From Processing......to Arduino Shaking Hands

More information

Basic Computer Programming (Processing)

Basic Computer Programming (Processing) Contents 1. Basic Concepts (Page 2) 2. Processing (Page 2) 3. Statements and Comments (Page 6) 4. Variables (Page 7) 5. Setup and Draw (Page 8) 6. Data Types (Page 9) 7. Mouse Function (Page 10) 8. Keyboard

More information

Computer Graphics with OpenGL ES (J. Han) Chapter XI Normal Mapping

Computer Graphics with OpenGL ES (J. Han) Chapter XI Normal Mapping Chapter XI Normal Mapping Bumpy Surfaces Image texturing only Fast Not realistic Highly tessellated mesh Realistic Slow 11-2 Surface Normal and Lighting Recall the interaction among light sources, surfaces,

More information

Introduction to Processing. Sally Kong

Introduction to Processing. Sally Kong Introduction to Processing Sally Kong - Open Source Platform - Geared toward creating visual, interactive media - Created by Ben Fry and Casey Reas Basic Setup void setup() { size(800, 600); background(255);

More information

PROJECT FINAL: WEARABLE

PROJECT FINAL: WEARABLE PROJECT FINAL: WEARABLE David Snow Wearable Computing Jackson McConnell Dec/09/2014 DEVICE: iris Project iris is a device that gamifies the experience of your daily drive. This is a device for all those

More information

CS 105: Introduction to Computer Programming (using JavaScript) Quiz: Khan Academy: Intro to While Loop

CS 105: Introduction to Computer Programming (using JavaScript) Quiz: Khan Academy: Intro to While Loop CS 05: Introduction to Computer Programming (using JavaScript) Loops Instructor: Joel Castellanos e-mail: joel@unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 39 0/8/207 Quiz: Khan

More information

1 Getting started with Processing

1 Getting started with Processing cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Guided Problem Solving

Guided Problem Solving -1 Guided Problem Solving GPS Student Page 57, Exercises 1 1: Match each rule with the correct translation. A. (x, y) (x, y 1 ) I. P(, 1) P (3, ) B. (x, y) (x 1 3, y) II. Q(3, 0) Q (3, ) C. (x, y) (x 1,

More information

Topics for section today. Homework 10 functions for loops and loading fonts

Topics for section today. Homework 10 functions for loops and loading fonts Topics for section today Homework 10 functions for loops and loading fonts Assignment 10 Sudoku Board Draw the Sudoku board in Processing using for-loops and functions Assignment 10 Sudoku Board Draw the

More information

SFPL Reference Manual

SFPL Reference Manual 1 SFPL Reference Manual By: Huang-Hsu Chen (hc2237) Xiao Song Lu(xl2144) Natasha Nezhdanova(nin2001) Ling Zhu(lz2153) 2 1. Lexical Conventions 1.1 Tokens There are six classes of tokes: identifiers, keywords,

More information

Connecting Arduino to Processing

Connecting Arduino to Processing Connecting Arduino to Processing Introduction to Processing So, you ve blinked some LEDs with Arduino, and maybe you ve even drawn some pretty pictures with Processing - what s next? At this point you

More information

Getting Started in Java CIS 110

Getting Started in Java CIS 110 Getting Started in Java CIS 110 2 Your First Program Program name 3 Your First Program The 4 li es aside fro the System.out li e are o sidered the Scaffolding of the program. Section 1.1 4 Your First Program

More information

CS12020 for CGVG. Practical 1. Jim Finnis

CS12020 for CGVG. Practical 1. Jim Finnis CS12020 for CGVG Practical 1 Jim Finnis (jcf1@aber.ac.uk) About me 20 years in the games industry (more or less) Windows, PS2, Xbox, Gamecube, Wii development experience DirectX (more than I like to think

More information

Class #1. introduction, functions, variables, conditionals

Class #1. introduction, functions, variables, conditionals Class #1 introduction, functions, variables, conditionals what is processing hello world tour of the grounds functions,expressions, statements console/debugging drawing data types and variables decisions

More information

[ the academy_of_code] Senior Beginners

[ the academy_of_code] Senior Beginners [ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell

More information

Loops. Variable Scope Remapping Nested Loops. Donald Judd. CS Loops 1. CS Loops 2

Loops. Variable Scope Remapping Nested Loops. Donald Judd. CS Loops 1. CS Loops 2 Loops Variable Scope Remapping Nested Loops CS105 05 Loops 1 Donald Judd CS105 05 Loops 2 judd while (expression) { statements CS105 05 Loops 3 Four Loop Questions 1. What do I want to repeat? - a rect

More information

CSC 120 Introduction to Creative Graphical Coding, Fall 2015

CSC 120 Introduction to Creative Graphical Coding, Fall 2015 CSC 120 Introduction to Creative Graphical Coding, Fall 2015 Dr. Dale E. Parson, Outline in preparation for assignment 2. How to move your avatar in a function and give it X, Y, and scaling parameters.

More information

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Mirage Language Reference Manual Image drawn using Mirage 1.1 Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Prof. Stephen Edwards Team Members: Abhilash I ai2160@columbia.edu

More information

COPYRIGHTED MATERIAL. Elements of the Language. C h a p t e r

COPYRIGHTED MATERIAL. Elements of the Language. C h a p t e r C h a p t e r 1 Elements of the Language Processing is a computer language originally conceived by Ben Fry and Casey Reas, students at the time (2001) at MIT. Their objective was to develop a simple language

More information

ISL RGB Sensor Tutorial By: Sabrina Jones

ISL RGB Sensor Tutorial By: Sabrina Jones ISL 25129 RGB Sensor Tutorial By: Sabrina Jones Overview The ISL29125 RGB sensor is a breakout board made to record the light intensity of the general red, green, and blue spectrums of visible light, that

More information

void set_target(unsigned char servo, unsigned int pozitie) { //merge la pozitia respectiva

void set_target(unsigned char servo, unsigned int pozitie) { //merge la pozitia respectiva a. Arduino #include Servo servo3; int servopin = 11; int senzor = 0; int val_senzor = 0; int LED = 8; int aux = 100; //librarie pentru servomotoare //declarare variabile void set_target(unsigned

More information

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018

StenBOT Robot Kit. Stensat Group LLC, Copyright 2018 StenBOT Robot Kit 1 Stensat Group LLC, Copyright 2018 Legal Stuff Stensat Group LLC assumes no responsibility and/or liability for the use of the kit and documentation. There is a 90 day warranty for the

More information

2IS45 Programming

2IS45 Programming Course Website Assignment Goals 2IS45 Programming http://www.win.tue.nl/~wsinswan/programmeren_2is45/ Rectangles Learn to use existing Abstract Data Types based on their contract (class Rectangle in Rectangle.

More information

CS 106 Winter 2016 Craig S. Kaplan. Module 08 Randomness and noise Topics

CS 106 Winter 2016 Craig S. Kaplan. Module 08 Randomness and noise Topics CS 106 Winter 2016 Craig S. Kaplan Module 08 Randomness and noise Topics The use of randomness as a design tool, controlling randomness in code Emergent design from simple rules Readings Learning Processing,

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

Pick a number. Conditionals. Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary. CS Conditionals 1

Pick a number. Conditionals. Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary. CS Conditionals 1 Conditionals Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary CS105 04 Conditionals 1 Pick a number CS105 04 Conditionals 2 Boolean Expressions An expression that

More information

Creating Icons for Leopard Buttons

Creating Icons for Leopard Buttons Creating Icons for Leopard Buttons Introduction Among the new features that C-Max 2.0 brings to the Ocelot and Leopard controllers, one of the more sophisticated ones allows the user to create icons that

More information

Variables One More (but not the last) Time with feeling

Variables One More (but not the last) Time with feeling 1 One More (but not the last) Time with feeling All variables have the following in common: a name a type ( int, float, ) a value an owner We can describe variables in terms of: who owns them ( Processing

More information

Recall that creating or declaring a variable can be done as follows:

Recall that creating or declaring a variable can be done as follows: Lesson 2: & Conditionals Recall that creating or declaring a variable can be done as follows:! float radius = 20;! int counter = 5;! string name = Mr. Nickel ;! boolean ispressed = true;! char grade =

More information

GIMP WEB 2.0 ICONS. GIMP is all about IT (Images and Text) OPEN GIMP

GIMP WEB 2.0 ICONS. GIMP is all about IT (Images and Text) OPEN GIMP GIMP WEB 2.0 ICONS or WEB 2.0 ICONS: MEMO Web 2.0 Icons: Memo GIMP is all about IT (Images and Text) OPEN GIMP Step 1: To begin a new GIMP project, from the Menu Bar, select File New. At the Create a New

More information

(a) Assume that in a certain country, tax is payable at the following rates:

(a) Assume that in a certain country, tax is payable at the following rates: 3 1. (Total = 12 marks) (a) Assume that in a certain country, tax is payable at the following rates: 15% on your first $50000 income 25% on any amount over $50000 Write a method that takes in an annual

More information

PieNum Language Reference Manual

PieNum Language Reference Manual PieNum Language Reference Manual October 2017 Hadiah Venner (hkv2001) Hana Fusman (hbf2113) Ogochukwu Nwodoh( ocn2000) Index Introduction 1. Lexical Convention 1.1. Comments 1.2. Identifiers 1.3. Keywords

More information

CS1950U Setup Spring 2018

CS1950U Setup Spring 2018 CS1950U Topics in 3D Game Engine Development Barbara Meier CS1950U Setup Spring 2018 Introduction Hi there! This guide is designed to help you get setup for taking CS1950U. It will go through the basics

More information

B Additional Recipes

B Additional Recipes B Additional Recipes Appendix B, Additional recipes, includes a select few recipes that take advantage of some of the features of AndEngine which are less likely to be included in the average development

More information

Name CMPS 5J Final March 17, 2010 This is a closed notes, closed book exam. Each problem is worth 1 point unless indicated otherwise.

Name CMPS 5J Final March 17, 2010 This is a closed notes, closed book exam. Each problem is worth 1 point unless indicated otherwise. Name CMPS 5J Final March 17, 2010 This is a closed notes, closed book exam. Each problem is worth 1 point unless indicated otherwise. There are 21 problems and 25 points total. There are multiple versions

More information

The NGT30 is an easy to use, 5v compatible propeller graphics device. It communicates simply with UART communication.

The NGT30 is an easy to use, 5v compatible propeller graphics device. It communicates simply with UART communication. The NGT30 is an easy to use, 5v compatible propeller graphics device. It communicates simply with UART communication. It will help you make your project by featuring: An Arduino shield-compatible interface

More information

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Additional Controls, Scope, Random Numbers, and Graphics CS109 In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Combo

More information

CISC 1600, Lab 3.2: Interactivity in Processing

CISC 1600, Lab 3.2: Interactivity in Processing CISC 1600, Lab 3.2: Interactivity in Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1.

More information

Programming: You will have 6 files all need to be located in the dir. named PA4:

Programming: You will have 6 files all need to be located in the dir. named PA4: PROGRAMMING ASSIGNMENT 4: Read Savitch: Chapter 7 and class notes Programming: You will have 6 files all need to be located in the dir. named PA4: PA4.java ShapeP4.java PointP4.java CircleP4.java RectangleP4.java

More information

Basic Input and Output

Basic Input and Output Basic Input and Output CSE 120 Winter 2019 Instructor: Teaching Assistants: Justin Hsia Ann Shan, Eunia Lee, Pei Lee Yap, Sam Wolfson, Travis McGaha Facebook to integrate WhatsApp, Instagram and Messenger

More information

L E S S O N 2 Background

L E S S O N 2 Background Flight, Naperville Central High School, Naperville, Ill. No hard hat needed in the InDesign work area Once you learn the concepts of good page design, and you learn how to use InDesign, you are limited

More information

mith College Computer Science CSC103 How Computers Work Week 6 Fall 2017 Dominique Thiébaut

mith College Computer Science CSC103 How Computers Work Week 6 Fall 2017 Dominique Thiébaut mith College Computer Science CSC103 How Computers Work Week 6 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Ben Fry on Processing... http://www.youtube.com/watch?&v=z-g-cwdnudu An Example Mouse 2D

More information

A B C D CS105 03a Interaction

A B C D CS105 03a Interaction Interaction Function Definition Events Built-in Variables CS105 03a Interaction 1 Which image is drawn by this code? strokeweight(10); stroke(0, 255, 0); // green line(99, 0, 0, 99); stroke(200, 0, 200);

More information

Introduction to version Instruction date

Introduction to version Instruction date Introduction to version 1.1.0 Instruction date 16.5.2008 Windows and Files Start by creating the window Open FCS data file By right-clicking the axis the list of available parameters appear. Right-click

More information

Computer Graphics. Making Pictures. Computer Graphics CSC470 1

Computer Graphics. Making Pictures. Computer Graphics CSC470 1 Computer Graphics Making Pictures Computer Graphics CSC470 1 Getting Started Making Pictures Graphics display: Entire screen (a); windows system (b); [both have usual screen coordinates, with y-axis y

More information

CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts

CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts The goal of this Python programming assignment is to write your own code inside a provided program framework, with some new graphical

More information

The Processing language. Arduino and Processing.

The Processing language. Arduino and Processing. IAT267 Introduc/on to Technological Systems Lecture 8 The Processing language. Arduino and Processing. 1 Course Project All teams submibed very interes/ng proposals One requirement for the project is to

More information

CREATING DESMOS ETOOLS

CREATING DESMOS ETOOLS CREATING DESMOS ETOOLS Table of Contents Using Desmos... 3 Creating & Using a Desmos Account (Top Black Bar)... 4 Domain/Range & Axis Labels & Zoom: (Right side Icons)... 6 Adding Items in the List Tray:

More information

Drawing Primitives. OpenGL basics

Drawing Primitives. OpenGL basics CSC 706 Computer Graphics / Dr. N. Gueorguieva 1 OpenGL Libraries Drawing Primitives OpenGL basics OpenGL core library OpenGL32 on Windows GL on most unix/linux systems (libgl.a) OpenGL Utility Library

More information

1. Complete these exercises to practice creating user functions in small sketches.

1. Complete these exercises to practice creating user functions in small sketches. Lab 6 Due: Fri, Nov 4, 9 AM Consult the Standard Lab Instructions on LEARN for explanations of Lab Days ( D1, D2, D3 ), the Processing Language and IDE, and Saving and Submitting. Rules: Do not use the

More information

1 Getting started with Processing

1 Getting started with Processing cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Marionette nodes - Vol. 1

Marionette nodes - Vol. 1 Marionette nodes - Vol. 1 1. 2D objects 1. Arc : Creates an arc object, or a polyline object. 2. GetRRDiam : Returns the horizontal and vertical diameters of the rounded corners of a rounded rectangle

More information

University of Cincinnati. P5.JS: Getting Started. p5.js

University of Cincinnati. P5.JS: Getting Started. p5.js p5.js P5.JS: Getting Started Matthew Wizinsky University of Cincinnati School of Design HTML + CSS + P5.js File Handling & Management Environment Canvas Coordinates Syntax Drawing Variables Mouse Position

More information

Functions. Functions. nofill(); point(20, 30); float angle = map(i, 0, 10, -2, 2); parameters return values

Functions. Functions. nofill(); point(20, 30); float angle = map(i, 0, 10, -2, 2); parameters return values Functions parameters return values 06 Functions 1 Functions Code that is packaged so it can be run by name Often has parameters to change how the function works (but not always) Often performs some computation

More information

Processing & Arduino in Tandem. Creating Your Own Digital Art Tools

Processing & Arduino in Tandem. Creating Your Own Digital Art Tools Processing & Arduino in Tandem Creating Your Own Digital Art Tools Week 2 - Making your own drawing tool Using Processing to build a basic application Segment 1 - A Basic Drawing Program Change window

More information

Fixed Perimeter Rectangles Geometry Creating a Document

Fixed Perimeter Rectangles Geometry Creating a Document Activity Overview: This activity provides the steps to create a TI-Nspire document that will be used to investigate side length and area in a rectangle with a fixed perimeter. An algebraic approach is

More information

Grove - Thumb Joystick

Grove - Thumb Joystick Grove - Thumb Joystick Introduction 3.3V 5.0V Analog Grove - Thumb Joystick is a Grove compatible module which is very similar to the analog joystick on PS2 (PlayStation 2) controllers. The X and Y axes

More information