Thursday, September 25, 2014

Tuesday, September 23, 2014

Honors Physics II: Week of 9/22/2014

We've done a number of online activities this week. In an effort to avoid confusion, here is a summary:

  • Arduino project research: Find three interesting/cool Arduino projects that someone else has created and shared online. Send (email) me a link and/or quick description of all three of them to get full credit. (Due Monday, September 22)
  • Initial project details: Complete an online form outlining your initial plans. Don't go into much detail in the materials section... ... we're going to tackle that today. (Due Wednesday, September 24)
  • Electronic components order form: Complete an online spreadsheet that lists your required electronics materials. Whether or not your component will be able to reused will largely determine if the school will be able to purchase it, so please consider this. Please try to find the needed objects according to the list of "options."

Wednesday, September 17, 2014

Knight Rider!

Photo by ryanmoto, used with CC licence.

Now that we've defeated some evil pigs over on Code.org, let's try our hand at using loops in the Arduino programming language. Rather than start from scratch, use the excellent tutorial that can be found at Arduino.cc (http://arduino.cc/en/Tutorial/Loop). Try to find 6 matching LEDs so your effects will look really cool.

Wednesday, September 10, 2014

Arduino Project 1


Introduction:
It's time to put what we've learned together into a (basic) project. Here's what we've worked on so far:

  • Connecting the Arduino to a computer
  • The Arduino IDE and uploading sketches
  • Using jumper wires with a solderless breadboard
  • Safely powering LEDs with Arduino
  • Using pins on Arduino as digital outputs and digital inputs
  • Using a momentary push button switch to indicate a logic state
  • Various Arduino commands and syntax, including
  • defining and assigning variables
  • pinMode()
  • digitalWrite()
  • digitalRead()
  • if()
  • else()
  • delay() 
At this point, you don't need to be an expert on all of the above-mentioned topics, but you should at least have a basic recollection of what we did and how they work. Go back and revisit our previous activities if necessary before continuing with this project.

Click through the break to begin this project:

Tuesday, September 9, 2014

A Toggle Button

Copy and past the code below the line of asterisks:

**********************************************

Friday, September 5, 2014

Working with Inputs (Introduction)


Image used under CC0 licence


Copy and paste the code that follows the line of asterisks:

*************************************************

// Define some variables for later use ...
//    - "const int" is used for values that won't chance in our sketch
//    - we're going to make a constant integer called "ledPin" and assign it to the pin the LED is connected to

const int ledPin = 8; // substitute whatever pin you're using for 8

//    - now make a constant integer called "buttonPin" and assign it to the pin the button (or switch) will be connected to

const int buttonPin = 5; // susbtitute whatever pin you're using for 5

//    - "int" is used for values that will change in our sketch
//    - we're going to make a integer variable called "buttonState" that we'll use to measure the button's state

int buttonState;

// Intialize the pins in the setup:

void setup()
{
  pinMode(ledPin,OUTPUT); 
  pinMode(buttonPin,INPUT_PULLUP);
}

// Put the code to be run over and over in the loop:

void loop()
{
  buttonState = digitalRead(buttonPin); // we're "reading" the voltage on in the input pin and assigning it to our variable called buttonState
  // Since we did a digital read, there are only two possible values now for buttonState -- it's either HIGH or LOW
  
  if(buttonState == HIGH)
  {
    digitalWrite(ledPin,HIGH);
  }

  else
  {
    digitalWrite(ledPin,LOW);
  }


}