-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Archive content from March 2014 Class
- Loading branch information
Showing
80 changed files
with
1,932 additions
and
0 deletions.
There are no files selected for viewing
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.
22 changes: 22 additions & 0 deletions
22
past_class_archive/2014_03/class_1/Basic_LED/Basic_LED.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
58
past_class_archive/2014_03/class_1/Traffic_Light/Traffic_Light.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
67 changes: 67 additions & 0 deletions
67
past_class_archive/2014_03/class_1/Traffic_Light_Arrive/Traffic_Light_Arrive.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
86 changes: 86 additions & 0 deletions
86
...s_archive/2014_03/class_1/Traffic_Light_AtHome_Solution/Traffic_Light_AtHome_Solution.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 added
BIN
+11 KB
past_class_archive/2014_03/class_2/Audio_Light_Show_AtHome_Solution.fzz
Binary file not shown.
Binary file added
BIN
+209 KB
past_class_archive/2014_03/class_2/Audio_Light_Show_AtHome_Solution.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions
54
...ive/2014_03/class_2/Audio_Light_Show_AtHome_Solution/Audio_Light_Show_AtHome_Solution.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
25 changes: 25 additions & 0 deletions
25
past_class_archive/2014_03/class_2/Flexpot_Buzzer/Flexpot_Buzzer.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
76 changes: 76 additions & 0 deletions
76
...ass_archive/2014_03/class_2/Traffic_Light_Delay_Solution/Traffic_Light_Delay_Solution.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.