Tuesday, November 19, 2013

Code for Workshop 3

double val;
void setup() {
  Serial.begin(9600);     //  setup serial
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
 
}
void loop() {
  val = analogRead(A0)-123;    // read analog input pin 3
  float Temp=CtoF(val);
  Serial.println(Temp);    // print to screen
 
  if (Temp > 85) {
    digitalWrite(13,HIGH);
    digitalWrite(12,HIGH);
  }else{
    digitalWrite(13,LOW);
    digitalWrite(12,LOW);
  }
 
  delay(1000);
 
}

double FtoC(double F)
{
   return ((F-32)*5)/9;
}
double CtoF(double C)
{
  return ((C*9)/5) + 32;
}

Monday, November 18, 2013

Workshop 3 - Clark A104

Remember, Arduino Workshop 3 is Tuesday night at 7pm! The location will be CLARK A104.

Come prepared to learn all about analog circuits!

Cameron

Friday, November 15, 2013

IEEE Open Design Competition Workshop 3 Tuesday at 6PM!

Hello everyone,

We will be holding the third Arduino Open Design Competition Workshop Tuesday, November 19th, at 6PM! (Location TBA) The third workshop will cover all things analog circuits, a must-have for most Arduino design projects.

As always, make sure to bring a well-charged laptop and your kits!

See you Tuesday,

Cameron Bloom
IEEE CSU Student Chapter President
Colorado State University

Tuesday, November 5, 2013

Introduction to Arduino Programming (Workshop 2) - Detailed Guide

Workshop Contents

I. C, C++, and the Arduino IDE

II. Variables
III. Methods
IV. Conditional
V. Loops
VI. I/O
VII. Demo - Pseudo Code Version
VIII. Demo - Code and Testing

I. C, C++, and the Arduino IDE


Programming on the Arduino is done with a variant of the C Language specific to the Arduino IDE. There are a few small differences, mainly regarding added functionality to relate to the Arduino properly, but for the most part programming is done in what can be thought of as C Language. 


C is the oldest programming language that is widely used today (created in 1972) and is a terrific language to start off with. It is considered a "High Level" language, meaning that on the spectrum of programming languages, it is closer to the English Language than machine code (all 0s and 1s). C is also very fundamentally similar to C++, Java, and many other modern languages, making it relatively easy to jump into one of these other languages from C. 


C isn't by any means a perfect language - there are a good handful of things that it can not do or that it is not good at doing, bit it is still an incredibly versatile, powerful language that works perfectly for programming Arduinos.


There are several key components to programming in C; this guide will cover those from a theoretical perspective that should be applicable to several other languages. The examples used will be in C to demonstrate proper C syntax.


Note: You can add comments to your code by putting two backslashes before any thing that isn't code. This way you can type notes in the program that don't affect the actual program. This is a good way for anyone reading the code to understand in plain English what is going on. It becomes more and more valuable as the program gets bigger and more complicated.


//This is a comment. 


/*

This is also a comment.
*/

Look for comments in the example code for further explanation.