Tips for fishtank programming living with the lab © 2013 David Hall.

Slides:



Advertisements
Similar presentations
Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
Advertisements

Lab7: Introduction to Arduino
temperature system wiring
Control of Salinity EAS 199B Modifications of ENGR 121 living with the lab.
Control of salinity living with the lab © 2012 David Hall.
Downloading, Installing, and Working with Dropbox.
Calibration of conductivity sensors living with the lab.
Debugging Introduction to Computing Science and Programming I.
1 Programming & Programming Languages Overview l Machine operations and machine language. l Example of machine language. l Different types of processor.
What to do when you are done. PRINTING WITH PHOTOSHOP.
H2-1 University of Washington Computer Programming I Lecture 10: Loop Development and Program Schemas © 2000 UW CSE.
Binary Arithmetic Math For Computers.
Parallax 4x20 LCD (part number 27979) with Arduino Duemilanove
Calibration of Conductivity Sensors EAS 199B. living with the lab cal ∙ i ∙ brate [kal-uh-breyt] -verb (used with object), -brat ∙ ed, -brat ∙ ing. 1.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Thermistor calibration living with the lab © 2013 David Hall.
Week 10 Today 1.Homework presentations and critique. 2.Review digital and analog inputs. 3.DIY - jumpers, soldering etc.
Calibration of Conductivity Sensors EAS 199B living with the lab.
A Computer Science Tapestry 1 Recursion (Tapestry 10.1, 10.3) l Recursion is an indispensable technique in a programming language ä Allows many complex.
General Programming Introduction to Computing Science and Programming I.
CS 122 Engineering Computation Lab Lab 2 Dan De Sousa and Tim Cheeseman Department of Computer Science Drexel University April 2009 ©By the author. All.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Introduction to Computer Programming Counting Loops.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Control of salinity living with the lab © 2012 David Hall.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
Intro Python: Variables, Indexing, Numbers, Strings.
File Input and Output (I/O) Engineering 1D04, Teaching Session 7.
Blackfin Array Handling Part 1 Making an array of Zeros void MakeZeroASM(int foo[ ], int N);
Counting Loops.
Simulation and Modeling: Predator-Prey Processing Lab IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 23, 2014 Carolyn Seaman Susan.
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Line following tips photoresistors positioned near floor photoresistor circuits © 2011 LWTL faculty team living with the lab.
Using for loops to control LEDs living with the lab 1 1 arduino.cc the for statement allows us to repeat a block of commands a limited number of times.
Lecture 7 Conditional Scripting and Importing/Exporting.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Algorithms and Pseudocode
1 Taking Notes. 2 STOP! Have I checked all your Source cards yet? Do they have a yellow highlighter mark on them? If not, you need to finish your Source.
Maryknoll Wireless Network Access Steps for Windows 7 As of Aug 20, 2012.
Introduction to Scratch We will be using the Scratch Environment today, so please log in to the Scratch website (scratch.mit.edu)
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
Comp1004: Introduction III Java. Content How Java Works: The JVM Writing a Class in Java – Class – Member Variables – Method – Statement Magic incantations.
2.1 First C Program. First Program Open visual studio, click new file Save as “programName.c” – Program must start with letter and have no spaces – Must.
Learning to use a ‘For Loop’ and a ‘Variable’. Learning Objective To use a ‘For’ loop to build shapes within your program Use a variable to detect input.
Arduino Programming Part 7: Flow charts and Top-down design ME 121 Gerald Recktenwald Portland State University
Arduino Programming. THE ARDUINO IS A MICROCONTROLLER – A LOW COST, LOW PERFORMANCE COMPUTER.
INTRODUCTION TO ROBOTICS Part 5: Programming
calibration of conductivity sensors
UCD ElecSoc Robotics Club 2017/2018
IF statements.
Basic Troubleshooting Techniques
We’ll be spending minutes talking about Quiz 1 that you’ll be taking at the next class session before you take the Gateway Quiz today.
Roller Coaster Design Project
Conductivity Sensor.
Using Photoresistors with an Arduino
INC 161 , CPE 100 Computer Programming
Putting it all together
Functions Pass By Value Pass by Reference
Module 4 Loops.
Chapter 1 Introduction of Arduino
Stata Basic Course Lab 2.
Building a website: Putting it all together
Calibration of Conductivity Sensors
Functions continued.
For Tutors Introduce yourself.
Basic Mr. Husch.
Arrays.
Presentation transcript:

tips for fishtank programming living with the lab © 2013 David Hall

write an Arudino program to compute salinity 2 living with the lab what data type should we use to store the salinity? what data type should we use to store the output? go to the arduino.cc website to see if you can figure out which data type might be best tip 1: use the correct data type

tip 2: take small steps & verify the result of each step 3 living with the lab print out EVERYTHING you calculate

4 living with the lab look on the LWTL website if you can’t remember how to print things out

don’t worry about this part right now tip 2 example: small steps with verification 5 living with the lab how do we enter this number? double salinity; void setup() { Serial.begin(9600); } void loop() { salinity = Serial.println(salinity); } try to figure out how to enter this number Don’t go to the next slide until you play around a few minutes, trying to figure this out on your own. Learning how to figure out things that you don’t know is an important part of programming!

tip 2 example continued: 6 living with the lab double salinity; void setup() { Serial.begin(9600); } void loop() { salinity = E-24; Serial.println(salinity); } The program seems to work, but only zeros are printed. How can we fix this? HINT: We did something similar when working with the LCD screen.

tip 2 example continued: 7 living with the lab double salinity; void setup() { Serial.begin(9600); } void loop() { salinity = E-24; Serial.println(salinity); } from LCD program: Change the print command to something like this and run the program:

tip 3: put in dummy values so calculations can be checked 8 living with the lab double salinity; int output; void setup() { Serial.begin(9600); } void loop() { // output=analogRead(0); output=500; salinity = E-24*pow(output,7.5472); Serial.println(output); Serial.println(salinity,29); } comment out your analogRead statement and just enter an estimated value for the output so that you can check your calculations!

tip 4: check EVERY number you compute 9 living with the lab double salinity; int output; void setup() { Serial.begin(9600); } void loop() { // output=analogRead(0); output=500; salinity = E-24*pow(output,7.5472); Serial.println(output); Serial.println(salinity,29); } Where did we fine out how to use the “pow” function? you MUST check this number on your calculator or in Excel... not doing so is just asking for trouble

tip 5: format your print statements to keep track of things 10 living with the lab double salinity; int output; void setup() { Serial.begin(9600); } void loop() { // output=analogRead(0); output=500; salinity = E-24*pow(output,7.5472); Serial.print("output = "); Serial.print(output); Serial.print(" salinity = "); Serial.println(salinity,29); } Comment out print statements when you are done with them, just in case you need them later.

tip 6: save all your old programs dealing with hardware 11 living with the lab Generally, if an old program doesn’t work anymore, then you have a HARDWARE problem (assuming things are wired to the same pins as in the original program). Isolating the problem as hardware or software related is a critical troubleshooting step. Most of the old programs are on the LWTL site under “content” if you lose them for some reason. (1)your conductivity calibration program a.if you start getting erroneous readings from your conductivity sensor, then rerun the calibration program. b.if it doesn’t work correctly, then you have a HARDWARE problem. c.if it does work correctly, then you have a SOFTWARE problem. (2)your original LCD program (3)a program to make the solenoid valves click on and off

tip 7: put “i am here” statements in your functions 12 living with the lab Serial.print("opening salty valve"); Serial.print("in upper main loop"); Serial.print("just finished measuring conductivity");

tip 8: restrain yourself people 13 living with the lab resist the temptation of typing in large chunks of code before checking program flow and calculation accuracy remember that you are a systematic problem solving machine