Movement using Shaft Encoders

Size: px
Start display at page:

Download "Movement using Shaft Encoders"

Transcription

1 Movement using Shaft Encoders Configure (Motors and Sensors Setup) We will look at the following in this section SensorValue[] while Conditions (<, >, <=, >=,!=, ==)

2 Quadrature/Shaft/Rotation Encoder 360 Ticks per revolution Counts up going forward, down going backwards Takes two digital input ports on the Cortex If the wires are plugged in in reverse order, then the counter will count backwards.

3 Configuring the Encoders Robot -> Motors and Sensors Setup

4 Name and Select 1) Select the VEX Cortex Digital Sensors 1-12 tab. 2) Name the encoder. (Start with a letter, no spaces, no punctuation, no reserved words, descriptive.) 3) Select the Sensor Type. Quadrature Encoder in this case. Note: On the Cortex the quadrature encoder cables must be plugged in next to each other. 4) Click Apply and OK

5 pragma Statements Created

6 Initializing and Reading the SensorValue[rightEncoder] is used to initialize (set to 0 in this case) and read encoder values. Encoder Initializes both encoder values to 0. While the value of the left encoder is less than 1800 it will go through the loop again. while (condition) { }

7 While Loops A while loop is a structure within ROBOTC which allows a section of code to be repeated as long as a certain condition remains true. There are three main parts to every while loop.

8 1. The word while Every while loop begins with the keyword while.

9 2. The Condition The condition controls how long or how many times a while loop repeats. While the condition is true, the while loop repeats; when the condition is false, the while loop ends and the robot moves on in the program. The condition is checked every time the loop repeats, before the commands between the curly braces are run.

10 3. Commands to be Repeated Commands placed between the curly braces will repeat while the (condition) is true when the program checks at the beginning of each pass through the loop.

11 Boolean Logic Decisions robots make must always based on questions which have only two possible answers: yes or no, true or false, right or wrong. Statements that can be only true or false are called Boolean statements, and their true-orfalse value is called a truth value.

12 Boolean Logic Conditions: True or False Conditions: Compare two items and return a true or a false value RobotC Comparison Operations < Is less than > Is greater than <= Is less than or equal to >= Is greater than or equal to == Is equal to!= Is no equal to

13 Boolean Logic

14 Conjunctions Conditions can be combined using conjunctions && (AND) while ((SensorValue[rightEncoder]<1800) && (SensorValue[leftEncoder] <1800)) { //while both encoders are less than 1800 it will repeat the code in the {} block } (OR) while ((SensorValue[rightEncoder]<1800) (SensorValue[leftEncoder] <1800)) { // While either the leftencoder<1800 or the rightencoder is <1800 it will //repeat the code inside the {} block }! (NOT) Turns true to false and false to true while!(sensorvalue(leftencoder)>1800)

15 Boolean Check: Fill in the Chart (T/F) x y x <= y y > 5 ( x <= y) && ( y > 5 )! (( x <= y) && ( y > 5 ))

16 Back to the Encoder Example SensorValue[rightEncoder] is used to initialize (set to 0 in this case) and read encoder values. Initializes both encoder values to 0. While the value of the left encoder is less than 1800 it will go through the loop again. while (condition) { } Test this code in the Virtual World. What happens if you add a wait1msec(12000); command inside the while loop?

17 Debugging: Watching the Sensor Open Debugger window for Sensors Robot->Degugger Windows -> Sensors Values

18 Watch the Values Run the program in the Virtual World Watch the sensor values change Sensor Values

19 Online Time Complete the Labyrinth Challenge using encoders rather than timers

20 Using Encoders to go Straight Limit drifting when trying to go straight In this section we will look at if

21 Pseudo Code (What we are trying to get the robot to do) While the robot has not reached the destination If the left motor has gone farther slow the left motor and have right motor go at speed If the right motor has gone farther slow the right motor and have the left motor go at speed If the motors are the same have both motors go at speed

22 If Statements When your robot reaches an if Statement in the program, it evaluates the condition contained between the parenthesis. If the condition is true, any commands between the braces are run. If the condition is false, those same commands are ignored. Very similar to how a while loop works, but does not repeat the code!

23 Going Straight: Translating to Code Pseudo Code While the robot has not reached the destination If the left motor has gone farther, slow the left motor and have right motor go at speed If the right motor has gone farther, slow the right motor and have the left motor go at speed If the motors are the same, have both motors go at speed

24 If-else statements The if-else Statement is an expansion of the basic if Statement. The if section still checks the condition and runs the appropriate commands when it evaluates to true Using the else allows for specific code to be run only when the condition is false. Either the if or the else branch is always run; no more, no less.

25 Chaining if..else if..else

26 Implementing if..else

27 But If the motors are not close in their Power to Speed then the difference between 50 and 63 might not be sufficient. So it will take some tweaking. Rather than changing the 63 to another value when modifying the at speed needed, you can use variables.

28 RobotC Variables int Stores integer values: 5, 0, -100 float Stores floating point (real) values: 3.01, -5.21, 0 string Stores words: Hello World char Stores single characters: bool Stores Boolean (true, false) values

29 Code After Using Variables for Speed Values Declaring the variables. type name Initialize the variables. Try modifying the fullspeed and slowerspeed values to see how if changes the robot behavior.

30 Summary: What do you recall about? motor[] SensorValue[] wait1msec() while if If..else Conditions Conjunctions Motors and Sensor Quadrature Encoder Strategies on going straight Timing vs. distance Variables

31 Online Time: Movement Challenge using the Shaft Encoders Basketball Drills Driving Straight I Driving Straight II Labyrinth Challenge Power Level Inv. Power Level Inv. (Encoders) Robot Acceleration Sentry Simulation I Sumo Bot Turning Inv. Encoders Turning Inv. Wait State Inv. Each of the movement challenge activities can be done using the encoder to improve consistency. For you use the encoders to solve the Labyrinth Challenge, then you can do others as time permits.

Variables and Functions. ROBOTC Software

Variables and Functions. ROBOTC Software Variables and Functions ROBOTC Software Variables A variable is a space in your robots memory where data can be stored, including whole numbers, decimal numbers, and words Variable names follow the same

More information

Getting Started in RobotC. // Comment task main() motor[] {} wait1msec() ; = Header Code Compile Download Run

Getting Started in RobotC. // Comment task main() motor[] {} wait1msec() ; = Header Code Compile Download Run Getting Started in RobotC // Comment task main() motor[] {} wait1msec() ; = Header Code Compile Download Run Understand Motion Learning Objectives Motors: How they work and respond. Fuses: Understand why

More information

Autonomy/Encoders Forward for Distance

Autonomy/Encoders Forward for Distance nomy/encoders Forward for Distance In this lesson, you will learn how to use an Encoder to more accurately control the distance that the robot will travel. 1. Your robot should have one encoder hooked

More information

Getting Started in RobotC. // Comment task main() motor[] {} wait1msec() ; = Header Code Compile Download Run

Getting Started in RobotC. // Comment task main() motor[] {} wait1msec() ; = Header Code Compile Download Run Getting Started in RobotC // Comment task main() motor[] {} wait1msec() ; = Header Code Compile Download Run Learning Objectives Explore Computer Programming using by controlling a virtual robot. Understand

More information

Activity Basic Inputs Programming - VEX Clawbot

Activity Basic Inputs Programming - VEX Clawbot Activity 3.1.3 Basic Inputs Programming - VEX Clawbot Introduction Inputs are devices which provide a processor with environmental information to make decisions. These devices have the capacity to sense

More information

RobotC. Remote Control

RobotC. Remote Control RobotC Remote Control Learning Objectives: Focusing on Virtual World with Physical Examples Understand Real-Time Joystick Mapping Understand how to use timers Understand how to incorporate buttons into

More information

G. Tardiani RoboCup Rescue. EV3 Workshop Part 1 Introduction to RobotC

G. Tardiani RoboCup Rescue. EV3 Workshop Part 1 Introduction to RobotC RoboCup Rescue EV3 Workshop Part 1 Introduction to RobotC Why use RobotC? RobotC is a more traditional text based programming language The more compact coding editor allows for large programs to be easily

More information

RCX Tutorial. Commands Sensor Watchers Stack Controllers My Commands

RCX Tutorial. Commands Sensor Watchers Stack Controllers My Commands RCX Tutorial Commands Sensor Watchers Stack Controllers My Commands The following is a list of commands available to you for programming the robot (See advanced below) On Turns motors (connected to ports

More information

Activity Basic Inputs Programming VEX

Activity Basic Inputs Programming VEX Activity 3.1.3 Basic Inputs Programming VEX Introduction Inputs are devices which provide a processor with environmental information to make decisions. These devices have the capacity to sense the environment

More information

2. Within your four student group, form a two student team known as Team A and a two student team known as Team B.

2. Within your four student group, form a two student team known as Team A and a two student team known as Team B. Introduction Inputs are devices which provide a processor with environmental information to make decisions. These devices have the capacity to sense the environment in a variety of ways such as physical

More information

Activity Basic Outputs Programming VEX

Activity Basic Outputs Programming VEX Activity 3.1.2 Basic Outputs Programming VEX Introduction Computer programs are used in many applications in our daily life. Devices that are controlled by a processor are called outputs. These devices

More information

Activity Basic Inputs Programming Answer Key (VEX)

Activity Basic Inputs Programming Answer Key (VEX) Activity 1.2.4 Basic Inputs Programming Answer Key (VEX) Introduction Inputs are devices which provide a processor with environmental information to make decisions. These devices have the capacity to sense

More information

Colin Harman and Jonathan Kim

Colin Harman and Jonathan Kim Colin Harman and Jonathan Kim 2-6-10 Getting RobotC 1. Go to robotc.net/robofest 2. Enter coach information including Robofestteam ID 3. The coach will get an email with a link to download RobotC(90-day

More information

Activity Basic Outputs Programming VEX

Activity Basic Outputs Programming VEX Activity 3.1.2 Basic Outputs Programming VEX Introduction Computer programs are used in many applications in our daily life. Devices that are controlled by a processor are called outputs. These devices

More information

VEX/RobotC Video Trainer Assignments

VEX/RobotC Video Trainer Assignments VEX/RobotC Video Trainer Assignments Mr. Holmes Mechatronics I To view the VEX videos assigned for homework, click on the following link to access the Vex Video Trainer: http://www.education.rec.ri.cmu.edu/products/teaching_robotc_cortex/

More information

Activity Basic Inputs Programming VEX

Activity Basic Inputs Programming VEX Activity 3.1.3 Basic Inputs Programming VEX Introduction Inputs are devices which provide a processor with environmental information to make decisions. These devices have the capacity to sense the environment

More information

Activity Variables and Functions VEX

Activity Variables and Functions VEX Activity 3.1.5 Variables and Functions VEX Introduction A program can accomplish a given task in any number of ways. Programs can quickly grow to an unmanageable size so variables and functions provide

More information

ROBOTC Basic Programming

ROBOTC Basic Programming ROBOTC Basic Programming Open ROBOTC and create a new file Check Compiler Target If you plan to download code to a robot, select the Physical Robot opbon. If you plan to download code to a virtual robot,

More information

Activity Basic Outputs Programming Answer Key (VEX) Introduction

Activity Basic Outputs Programming Answer Key (VEX) Introduction Activity 1.2.3 Basic Outputs Programming Answer Key (VEX) Introduction Computer programs are used in many applications in our daily life. Devices that are controlled by a processor are called outputs.

More information

RobotC for VEX. By Willem Scholten Learning Access Institute

RobotC for VEX. By Willem Scholten Learning Access Institute RobotC for VEX By Willem Scholten Learning Access Institute 1 RobotCgetStarted.key - February 5, 2016 RobotC for VEX Section 1 - RobotC How to switch between VEX 2.0 Cortex and VEX IQ Section 2 - RobotC

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

TETRIX Getting Started Guide. Harvester and Transporter Programming Guide (ROBOTC )

TETRIX Getting Started Guide. Harvester and Transporter Programming Guide (ROBOTC ) Introduction: In this guide, the Ranger Bot will be programmed to follow a line, pick up an object using the harvester, and put the object into the transporter. It will also count the number of objects

More information

Troubleshooting ROBOTC with Cortex

Troubleshooting ROBOTC with Cortex This guide is to designed to be used by a student or teacher as a reference for help troubleshooting ROBOTC software issues. Troubleshooting Topics Computer will not Recognize the VEX Cortex Not able to

More information

CP122 CS I. Chapter 6a: Iteration I

CP122 CS I. Chapter 6a: Iteration I CP122 CS I Chapter 6a: Iteration I Supreme Court ruling: Samsung's violation of Apple's iphone patents may only involve components and not whole phone Tech News! Tech News! Supreme Court ruling: Samsung's

More information

2

2 1 2 3 4 5 6 7 8 9 Robot C Settings for Programming in VEX IQ Text Mode Setup the software for Vex IQ: Platform Tab: Platform Type [Vex Robotics] [VEX IQ] Quick

More information

Boolean Expressions (Conditions)

Boolean Expressions (Conditions) Boolean Expressions (Conditions) Boolean Expressions: Boolean expressions evaluate to either True or False. Boolean expressions are constructed using relational operators, which allow for comparison between

More information

Programming in ROBOTC ROBOTC Rules

Programming in ROBOTC ROBOTC Rules Programming in ROBOTC ROBOTC Rules In this lesson, you will learn the basic rules for writing ROBOTC programs. ROBOTC is a text-based programming language Commands to the robot are first written as text

More information

Theory of control structures

Theory of control structures Theory of control structures Paper written by Bohm and Jacopini in 1966 proposed that all programs can be written using 3 types of control structures. Theory of control structures sequential structures

More information

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

Chapter 1: Getting Started

Chapter 1: Getting Started Chapter 1: Getting Started Hello, and welcome to RBE 1001! This book will help you learn about how to use your Arduino to control a robot, including how to use various types of motors and sensors with

More information

16-311: Getting Started with ROBOTC and the. LEGO Mindstorms NXT. Aurora Qian, Billy Zhu

16-311: Getting Started with ROBOTC and the. LEGO Mindstorms NXT. Aurora Qian, Billy Zhu 16-311: Getting Started with ROBOTC and the LEGO Mindstorms NXT Aurora Qian, Billy Zhu May, 2016 Table of Contents 1. Download and Install 2. License Activation 3. Wireless Connection 4. Running Programs

More information

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d.

Chapter 4: Control Structures I (Selection) Objectives. Objectives (cont d.) Control Structures. Control Structures (cont d. Chapter 4: Control Structures I (Selection) In this chapter, you will: Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

SSOL Language Reference Manual

SSOL Language Reference Manual SSOL Language Reference Manual Madeleine Tipp Jeevan Farias Daniel Mesko mrt2148 jtf2126 dpm2153 Manager Language Guru System Architect October 15, 2018 Contents 1 Lexical Conventions 2 1.1 Identifiers...............................................

More information

Boolean evaluation and if statements. Making decisions in programs

Boolean evaluation and if statements. Making decisions in programs Boolean evaluation and if statements Making decisions in programs Goals By the end of this lesson you will be able to: Understand Boolean logic values Understand relational operators Understand if and

More information

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j;

General Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j; General Syntax Statements are the basic building block of any C program. They can assign a value to a variable, or make a comparison, or make a function call. They must be terminated by a semicolon. Every

More information

Activity While Loops and If-Else Structures VEX

Activity While Loops and If-Else Structures VEX Activity 3.1.4 While Loops and If-Else Structures VEX Introduction One of the powerful attributes of a computer program is its ability to make decisions. Although it can be argued that only humans are

More information

Lecture 2 Tao Wang 1

Lecture 2 Tao Wang 1 Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors

More information

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1 topics: introduction to java, part 1 cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 cis20.1-fall2007-sklar-leci.2 1 Java. Java is an object-oriented language: it is

More information

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE

CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE CAMBRIDGE SCHOOL, NOIDA ASSIGNMENT 1, TOPIC: C++ PROGRAMMING CLASS VIII, COMPUTER SCIENCE a) Mention any 4 characteristic of the object car. Ans name, colour, model number, engine state, power b) What

More information

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char

Review. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char Review Primitive Data Types & Variables int, long float, double boolean char String Mathematical operators: + - * / % Comparison: < > = == 1 1.3 Conditionals and Loops Introduction to Programming in

More information

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017 Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls

More information

TETRIX Getting Started Guide. Launcher Programming Guide (ROBOTC )

TETRIX Getting Started Guide. Launcher Programming Guide (ROBOTC ) Introduction: In this guide, the Ranger Bot will be programmed to follow a line while carrying a ball. Upon sensing a bin with its ultrasonic sensor, it will launch the ball into the bin. This guide is

More information

1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl?

1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl? Exercises with solutions. 1. a) What #include statement do you put at the top of a program that does uses cin, cout or endl? #include b) What using statement do you always put at the top of

More information

The Beginners Guide to ROBOTC. Volume 2, 3 rd Edition Written by George Gillard Published: 18-July-2016

The Beginners Guide to ROBOTC. Volume 2, 3 rd Edition Written by George Gillard Published: 18-July-2016 The Beginners Guide to ROBOTC Volume 2, 3 rd Edition Written by George Gillard Published: 18-July-2016 Introduction ROBOTC is an application used for programming robots. There are many different versions

More information

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program?

Intro to Programming & C Why Program? 1.2 Computer Systems: Hardware and Software. Why Learn to Program? Intro to Programming & C++ Unit 1 Sections 1.1-4 and 2.1-10, 2.12-13, 2.15-17 CS 1428 Spring 2019 Jill Seaman 1.1 Why Program? Computer programmable machine designed to follow instructions Program a set

More information

5. Control Statements

5. Control Statements 5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements

More information

Testing VEX Cortex Robots using VEXnet

Testing VEX Cortex Robots using VEXnet Testing VEX Cortex Robots using VEXnet This document is an inspection guide for VEX Cortex based robots. Use this document to test if a robot is competition ready. Method I. Using the ROBOTC Competition

More information

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

CSc Introduction to Computing

CSc Introduction to Computing CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments

More information

CSI33 Data Structures

CSI33 Data Structures Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence

More information

Relational Operators and if. Class 10

Relational Operators and if. Class 10 Relational Operators and if Class 10 Data Type a data type consists of two things: Data Type a data type consists of two things: a set of values Data Type a data type consists of two things: a set of values

More information

The Power Turtle Drivetrain

The Power Turtle Drivetrain The Power Turtle Drivetrain Before you start, make sure you have the right parts available. Set these parts on a table, and put all other parts away for now. Brain & Battery 4 small gears 1 4x8 plate 4

More information

Six Omni Wheel Chain Drivetrain

Six Omni Wheel Chain Drivetrain Six Omni Wheel Chain Drivetrain Before you start, make sure you have the right parts available. Set these parts on a table, and put all other parts away for now. [Note, this can be built with only 4 omni

More information

ARG! Language Reference Manual

ARG! Language Reference Manual ARG! Language Reference Manual Ryan Eagan, Mike Goldin, River Keefer, Shivangi Saxena 1. Introduction ARG is a language to be used to make programming a less frustrating experience. It is similar to C

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

More information

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal

Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Selec%on and Decision Structures in Java: If Statements and Switch Statements CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand Control Structures Understand how to control the flow of a program

More information

Logic & program control part 2: Simple selection structures

Logic & program control part 2: Simple selection structures Logic & program control part 2: Simple selection structures Summary of logical expressions in Java boolean expression means an expression whose value is true or false An expression is any valid combination

More information

Control Structures. Control Structures Conditional Statements COMPUTER PROGRAMMING. Electrical-Electronics Engineering Dept.

Control Structures. Control Structures Conditional Statements COMPUTER PROGRAMMING. Electrical-Electronics Engineering Dept. EEE-117 COMPUTER PROGRAMMING Control Structures Conditional Statements Today s s Objectives Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical

More information

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Chapter 3. More Flow of Control. Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 More Flow of Control Overview 3.1 Using Boolean Expressions 3.2 Multiway Branches 3.3 More about C++ Loop Statements 3.4 Designing Loops Slide 3-3 Flow Of Control Flow of control refers to the

More information

Lecture 5 Tao Wang 1

Lecture 5 Tao Wang 1 Lecture 5 Tao Wang 1 Objectives In this chapter, you will learn about: Selection criteria Relational operators Logical operators The if-else statement Nested if statements C++ for Engineers and Scientists,

More information

RobotC primer. Alexander Kirillov

RobotC primer. Alexander Kirillov RobotC primer version 1.1, September 2013 Alexander Kirillov IslandBots robotic club URL: http://islandbots.org/robotc/ E-mail address: shurik179@gmail.com This work is licensed under the Creative Commons

More information

Activity While Loops and If-Else Structures Answer Key (VEX) Introduction

Activity While Loops and If-Else Structures Answer Key (VEX) Introduction Activity 1.2.5 While Loops and If-Else Structures Answer Key (VEX) Introduction One of the powerful attributes of a computer program is its ability to make decisions. Although it can be argued that only

More information

LECTURE 5 Control Structures Part 2

LECTURE 5 Control Structures Part 2 LECTURE 5 Control Structures Part 2 REPETITION STATEMENTS Repetition statements are called loops, and are used to repeat the same code multiple times in succession. The number of repetitions is based on

More information

EQ-ROBO Programming : Ladybird Robot

EQ-ROBO Programming : Ladybird Robot EQ-ROBO Programming : Ladybird Robot Program begin Input port setting Output port setting a b Robot goes forward if there is no obstacle in front of robot. If the robot detect the obstacle in front side

More information

Visual C# Instructor s Manual Table of Contents

Visual C# Instructor s Manual Table of Contents Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms

More information

If you note any errors, typos, etc. with this manual or our software libraries, let us know at

If you note any errors, typos, etc. with this manual or our software libraries, let us know at Oregon State University Robotics Club ORK 2011 Programming Guide Version 1.0 Updated: 10/28/2011 Note: Check back for more revisions and updates soon! If you note any errors, typos, etc. with this manual

More information

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 2-1 Parts of a C++ Program Parts of a C++ Program // sample C++ program

More information

COMP 202 Java in one week

COMP 202 Java in one week COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of

More information

Lecture 6. Assignments. Summary - Variables. Summary Program Parts 1/29/18. Reading: 3.1, 3.2, 3.3, 3.4

Lecture 6. Assignments. Summary - Variables. Summary Program Parts 1/29/18. Reading: 3.1, 3.2, 3.3, 3.4 Assignments Lecture 6 Complete for Project 1 Reading: 3.1, 3.2, 3.3, 3.4 Summary Program Parts Summary - Variables Class Header (class name matches the file name prefix) Class Body Because this is a program,

More information

Program your face off

Program your face off Program your face off Game plan Basics of Programming Primitive types, loops, and conditionals. What is an Object oriented language? Tips and tricks of WPIlib Iterative and Command Based robots Feedback

More information

Chapter 4 - Notes Control Structures I (Selection)

Chapter 4 - Notes Control Structures I (Selection) Chapter 4 - Notes Control Structures I (Selection) I. Control Structures A. Three Ways to Process a Program 1. In Sequence: Starts at the beginning and follows the statements in order 2. Selectively (by

More information

Decision Making in C

Decision Making in C Decision Making in C Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed

More information

Selection statements. CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington

Selection statements. CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington Selection s CSE 1310 Introduction to Computers and Programming Alexandra Stefan University of Texas at Arlington 1 Book reference Book: The practice of Computing Using Python 2-nd edition Second hand book

More information

BTE2313. Chapter 2: Introduction to C++ Programming

BTE2313. Chapter 2: Introduction to C++ Programming For updated version, please click on http://ocw.ump.edu.my BTE2313 Chapter 2: Introduction to C++ Programming by Sulastri Abdul Manap Faculty of Engineering Technology sulastri@ump.edu.my Objectives In

More information

C Programming with Mini Sumo Robots

C Programming with Mini Sumo Robots C Programming with Mini Sumo Robots Editing and Compiling a Program -Open Programmer s Notepad. This will bring up a tool for editing and compiling your program: -Start Menu -> Programmers Notepad -> Programmers

More information

Chapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.

Chapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved. Chapter 2 C++ Basics 1 Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Slide 2-3 2.1 Variables and Assignments 2

More information

Review Questions I Spring 2010

Review Questions I Spring 2010 Review Questions I Spring 2010 The following review questions are similar to the kinds of questions you will be expected to answer on Exam I (tentatively scheduled for Mar. 4), which will cover LCR, chs.

More information

Object Oriented Programming with Java

Object Oriented Programming with Java Object Oriented Programming with Java What is Object Oriented Programming? Object Oriented Programming consists of creating outline structures that are easily reused over and over again. There are four

More information

CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016

CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016 CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016 In this course you will start by building a compiler for a language called Xi. This is an imperative,

More information

COMP-202: Foundations of Programming

COMP-202: Foundations of Programming COMP-202: Foundations of Programming Lecture 3: Basic data types Jackie Cheung, Winter 2016 Review: Hello World public class HelloWorld { } public static void main(string[] args) { } System.out.println("Hello,

More information

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 23 Introduction to Arduino- II Hi. Now, we will continue

More information

! Before you start, make sure you have the right parts available. Set these parts on a table, and put all other parts away for now.

! Before you start, make sure you have the right parts available. Set these parts on a table, and put all other parts away for now. Tank Tread Drivetrain Before you start, make sure you have the right parts available. Set these parts on a table, and put all other parts away for now. Brain & Battery 4 1x standoffs 4 2x2 black connectors

More information

Pace University. Fundamental Concepts of CS121 1

Pace University. Fundamental Concepts of CS121 1 Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

More information

Your first C++ program

Your first C++ program Your first C++ program #include using namespace std; int main () cout

More information

Introduction. C provides two styles of flow control:

Introduction. C provides two styles of flow control: Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if

More information

Introduction to C++ General Rules, Conventions and Styles CS 16: Solving Problems with Computers I Lecture #2

Introduction to C++ General Rules, Conventions and Styles CS 16: Solving Problems with Computers I Lecture #2 Introduction to C++ General Rules, Conventions and Styles CS 16: Solving Problems with Computers I Lecture #2 Ziad Matni Dept. of Computer Science, UCSB Administrative This class is currently FULL and

More information

Chars and strings. Representation of characters (char) Representation of characters (char) Strings. Represent sequences of characters.

Chars and strings. Representation of characters (char) Representation of characters (char) Strings. Represent sequences of characters. Representation of characters (char) Character (char). Represent letters, digits, punctuation marks and control characters. Chars and strings Every character is represented by a code (integer number). There

More information

CSCI 131, Midterm Exam 1 Review Questions This sheet is intended to help you prepare for the first exam in this course. The following topics have

CSCI 131, Midterm Exam 1 Review Questions This sheet is intended to help you prepare for the first exam in this course. The following topics have CSCI 131, Midterm Exam 1 Review Questions This sheet is intended to help you prepare for the first exam in this course. The following topics have been covered in the first 5 weeks of the course. The exam

More information

Relationship of class to object

Relationship of class to object Relationship of class to object Writing and programming Writing a program is similar to many other kinds of writing. The purpose of any kind of writing is to take your thoughts and let other people see

More information

Key Differences Between Python and Java

Key Differences Between Python and Java Python Python supports many (but not all) aspects of object-oriented programming; but it is possible to write a Python program without making any use of OO concepts. Python is designed to be used interpretively.

More information

Activity Inputs and Outputs VEX

Activity Inputs and Outputs VEX Activity 3.1.1 Inputs and Outputs VEX Introduction Robots are similar to humans if you consider that both use inputs and outputs to sense and react to the world. Most humans use five senses to perceive

More information

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm.

The sequence of steps to be performed in order to solve a problem by the computer is known as an algorithm. CHAPTER 1&2 OBJECTIVES After completing this chapter, you will be able to: Understand the basics and Advantages of an algorithm. Analysis various algorithms. Understand a flowchart. Steps involved in designing

More information

K Force The Kristin Robotics Team Introductory Programming Tutorial 2014 For use with the teams squarebot training robots.

K Force The Kristin Robotics Team Introductory Programming Tutorial 2014 For use with the teams squarebot training robots. K Force The Kristin Robotics Team Introductory Programming Tutorial 2014 For use with the teams squarebot training robots. K Force Squarebot Programming Course - 2014 Robot moves forward for two seconds

More information

Add Subtract Multiply Divide

Add Subtract Multiply Divide ARITHMETIC OPERATORS if AND if/else AND while LOOP Order of Operation (Precedence Part 1) Copyright 2014 Dan McElroy Add Subtract Multiply Divide + Add - Subtract * Multiply / Divide = gives the quotient

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work

More information

The Big Idea: Background: About Serial

The Big Idea: Background: About Serial Lesson 6 Lesson 6: Serial Serial Input Input The Big Idea: Information coming into an Arduino sketch is called input. This lesson focuses on text in the form of characters that come from the user via the

More information

Mr. Monroe s Guide to Mastering Java Syntax

Mr. Monroe s Guide to Mastering Java Syntax Mr. Monroe s Guide to Mastering Java Syntax Getting Started with Java 1. Download and install the official JDK (Java Development Kit). 2. Download an IDE (Integrated Development Environment), like BlueJ.

More information

Computer Programming : C++

Computer Programming : C++ The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming : C++ Experiment #1 Basics Contents Structure of a program

More information

COMP-202: Foundations of Programming. Lecture 6: Conditionals Jackie Cheung, Winter 2016

COMP-202: Foundations of Programming. Lecture 6: Conditionals Jackie Cheung, Winter 2016 COMP-202: Foundations of Programming Lecture 6: Conditionals Jackie Cheung, Winter 2016 This Lecture Finish data types and order of operations Conditionals 2 Review Questions What is the difference between

More information

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

More information