Skip to content

Commit

Permalink
Archive content from March 2014 Class
Browse files Browse the repository at this point in the history
  • Loading branch information
rpurser47 committed Aug 8, 2014
1 parent 1724df3 commit cd3e26a
Show file tree
Hide file tree
Showing 80 changed files with 1,932 additions and 0 deletions.
Binary file added past_class_archive/2014_03/class_1/Basic_LED.fzz
Binary file not shown.
Binary file added past_class_archive/2014_03/class_1/Basic_LED.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions past_class_archive/2014_03/class_1/Basic_LED/Basic_LED.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013

void setup()
{
pinMode(13,OUTPUT);
}

void loop()
{
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
digitalWrite(13,HIGH);
delay(250);
digitalWrite(13,LOW);
delay(250);
}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions past_class_archive/2014_03/class_1/Traffic_Light/Traffic_Light.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013

int signal1RedPin = 13;
int signal1YellowPin = 12;
int signal1GreenPin = 11;
int signal2RedPin = 10;
int signal2YellowPin = 9;
int signal2GreenPin = 8;

void setup()
{
Serial.begin(9600);
pinMode(signal1RedPin,OUTPUT);
pinMode(signal1YellowPin,OUTPUT);
pinMode(signal1GreenPin,OUTPUT);
pinMode(signal2RedPin,OUTPUT);
pinMode(signal2YellowPin,OUTPUT);
pinMode(signal2GreenPin,OUTPUT);
digitalWrite(signal2RedPin,HIGH);
}

void loop()
{
Serial.println("Green Red");
digitalWrite(signal1RedPin,LOW);
digitalWrite(signal1GreenPin,HIGH);
delay(5000);

Serial.println("Yellow Red");
digitalWrite(signal1GreenPin,LOW);
digitalWrite(signal1YellowPin,HIGH);
delay(1000);

Serial.println("Red Red");
digitalWrite(signal1YellowPin,LOW);
digitalWrite(signal1RedPin,HIGH);
delay(500);

Serial.println("Red Green");
digitalWrite(signal2RedPin,LOW);
digitalWrite(signal2GreenPin,HIGH);
delay(5000);

Serial.println("Red Yellow");
digitalWrite(signal2GreenPin,LOW);
digitalWrite(signal2YellowPin,HIGH);
delay(1000);

Serial.println("Red Red");
digitalWrite(signal2YellowPin,LOW);
digitalWrite(signal2RedPin,HIGH);
delay(500);

}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013

int signal1RedPin = 13;
int signal1YellowPin = 12;
int signal1GreenPin = 11;
int signal2RedPin = 10;
int signal2YellowPin = 9;
int signal2GreenPin = 8;
int arrivalSensorPin = 7;

void setup()
{
Serial.begin(9600);
pinMode(signal1RedPin,OUTPUT);
pinMode(signal1YellowPin,OUTPUT);
pinMode(signal1GreenPin,OUTPUT);
pinMode(signal2RedPin,OUTPUT);
pinMode(signal2YellowPin,OUTPUT);
pinMode(signal2GreenPin,OUTPUT);
digitalWrite(signal2RedPin,HIGH);

pinMode(arrivalSensorPin,INPUT_PULLUP);//Exercise 3
}

void loop()
{
Serial.println("Green Red -- waiting on arrival");
digitalWrite(signal1RedPin,LOW);
digitalWrite(signal1GreenPin,HIGH);

// Wait for the arrival sensor to go low
while(digitalRead(arrivalSensorPin) == HIGH)
{
delay(100);
}
Serial.println("Arrival Sensor Triggered");

Serial.println("Yellow Red");
digitalWrite(signal1GreenPin,LOW);
digitalWrite(signal1YellowPin,HIGH);
delay(1000);

Serial.println("Red Red");
digitalWrite(signal1YellowPin,LOW);
digitalWrite(signal1RedPin,HIGH);
delay(500);

Serial.println("Red Green");
digitalWrite(signal2RedPin,LOW);
digitalWrite(signal2GreenPin,HIGH);
delay(5000);

Serial.println("Red Yellow");
digitalWrite(signal2GreenPin,LOW);
digitalWrite(signal2YellowPin,HIGH);
delay(1000);

Serial.println("Red Red");
digitalWrite(signal2YellowPin,LOW);
digitalWrite(signal2RedPin,HIGH);
delay(500);

}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013

int signal1RedPin = 13;
int signal1YellowPin = 12;
int signal1GreenPin = 11;
int signal2RedPin = 10;
int signal2YellowPin = 9;
int signal2GreenPin = 8;

int arrival1SensorPin = 6;
int arrival2SensorPin = 7;


void setup()
{
Serial.begin(9600);
pinMode(signal1RedPin,OUTPUT);
pinMode(signal1YellowPin,OUTPUT);
pinMode(signal1GreenPin,OUTPUT);
pinMode(signal2RedPin,OUTPUT);
pinMode(signal2YellowPin,OUTPUT);
pinMode(signal2GreenPin,OUTPUT);
digitalWrite(signal2RedPin,HIGH);

pinMode(arrival1SensorPin,INPUT_PULLUP);
pinMode(arrival2SensorPin,INPUT_PULLUP);

Serial.println("Red Red -- waiting on arrival");
digitalWrite(signal1RedPin,HIGH);
digitalWrite(signal1RedPin,HIGH);
}

void loop()
{
// Wait for the arrival 1 sensor to go low
if(digitalRead(arrival1SensorPin) == LOW)
{
Serial.println("Arrival Sensor 1 Triggered");

Serial.println("Green Red");
digitalWrite(signal1RedPin,LOW);
digitalWrite(signal1GreenPin,HIGH);

// Wait for the vehicle to pass
delay(5000);

Serial.println("Yellow Red");
digitalWrite(signal1GreenPin,LOW);
digitalWrite(signal1YellowPin,HIGH);
delay(500);

Serial.println("Red Red -- waiting on arrival");
digitalWrite(signal1YellowPin,LOW);
digitalWrite(signal1RedPin,HIGH);

}
else if(digitalRead(arrival2SensorPin) == LOW)
{
Serial.println("Arrival Sensor 2 Triggered");

Serial.println("Red Green");
digitalWrite(signal2RedPin,LOW);
digitalWrite(signal2GreenPin,HIGH);

// Wait for the vehicle to pass
delay(5000);

Serial.println("Red Yellow");
digitalWrite(signal2GreenPin,LOW);
digitalWrite(signal2YellowPin,HIGH);
delay(500);

Serial.println("Red Red -- waiting on arrival");
digitalWrite(signal2YellowPin,LOW);
digitalWrite(signal2RedPin,HIGH);
}
else
{
delay(100);
}
}

Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013-2014

int flexpotPin = 0;
int buzzerPin = 6;

int led1 = 7;
int led2 = 8;
int led3 = 9;

void setup()
{
Serial.begin(9600);
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
}

void loop()
{
unsigned int flexpotValue = analogRead(flexpotPin);
Serial.print("Flexpot: ");
Serial.print(flexpotValue);
// My flexpot gave values between about 600 when unbent, to 850 when fully bent.
unsigned int pitch = map(flexpotValue, 600, 850, 200, 1000);
Serial.print(" Pitch: ");
Serial.println(pitch);
tone(buzzerPin,pitch,100);

unsigned int pinState;

if (pitch < 300) {
digitalWrite(led1,LOW);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
} else if (pitch < 500) {
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,LOW);
} else if (pitch < 700) {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
} else {
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
}
}


Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013-2014

int flexpotPin = 0;
int buzzerPin = 6;

void setup()
{
Serial.begin(9600);
}

void loop()
{
unsigned int flexpotValue = analogRead(flexpotPin);
Serial.print("Flexpot: ");
Serial.print(flexpotValue);
// My flexpot gave values between about 600 when unbent, to 850 when fully bent.
unsigned int pitch = map(flexpotValue, 600, 850, 200, 1000);
Serial.print(" Pitch: ");
Serial.println(pitch);
tone(buzzerPin,pitch,100);
}
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Fun with Arduino by Rob Purser is licensed under a
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_US
// Based on a work at https://sites.google.com/site/funarduino/
// Copyright Rob Purser, 2013

int signal1RedPin = 13;
int signal1YellowPin = 12;
int signal1GreenPin = 11;
int signal2RedPin = 10;
int signal2YellowPin = 9;
int signal2GreenPin = 8;
int arrivalSensorPin = 7;
int delayTimingPin = 0;

void setup()
{
Serial.begin(9600);
pinMode(signal1RedPin,OUTPUT);
pinMode(signal1YellowPin,OUTPUT);
pinMode(signal1GreenPin,OUTPUT);
pinMode(signal2RedPin,OUTPUT);
pinMode(signal2YellowPin,OUTPUT);
pinMode(signal2GreenPin,OUTPUT);
digitalWrite(signal2RedPin,HIGH);

pinMode(arrivalSensorPin,INPUT_PULLUP);//Exercise 3
}

void loop()
{
Serial.println("Green Red -- waiting on arrival");
digitalWrite(signal1RedPin,LOW);
digitalWrite(signal1GreenPin,HIGH);

while(digitalRead(arrivalSensorPin) == HIGH)
{
delay(100);
}

Serial.println("Yellow Red");
digitalWrite(signal1GreenPin,LOW);
digitalWrite(signal1YellowPin,HIGH);
delay(1000);

Serial.println("Red Red");
digitalWrite(signal1YellowPin,LOW);
digitalWrite(signal1RedPin,HIGH);
delay(500);

//Serial.println("Red Green");
digitalWrite(signal2RedPin,LOW);
digitalWrite(signal2GreenPin,HIGH);

// Exercise: Replace this delay with code to read the knob and map it to a delay.
//delay(5000);
int delayTimingReading = analogRead(delayTimingPin);
int delayInMs = map(delayTimingReading,0,1023,1000,15000);
Serial.print("Red Green - a reading of ");
Serial.print(delayTimingReading);
Serial.print(" creates a delay of ");
Serial.print(delayInMs);
Serial.println("ms.");
delay(delayInMs);

Serial.println("Red Yellow");
digitalWrite(signal2GreenPin,LOW);
digitalWrite(signal2YellowPin,HIGH);
delay(1000);

Serial.println("Red Red");
digitalWrite(signal2YellowPin,LOW);
digitalWrite(signal2RedPin,HIGH);
delay(500);

}
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit cd3e26a

Please sign in to comment.