-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
936 additions
and
9 deletions.
There are no files selected for viewing
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,223 @@ | ||
#include <Servo.h> | ||
|
||
Servo waver, dancer; | ||
|
||
// Analog Pins free inventory: 0,1,2,3,4,5 | ||
|
||
// Digital Pins for Input | ||
const int buttonPin = 2; | ||
|
||
// Digital Pins for Output | ||
const int heartPin3 = 3; | ||
const int heartPin4 = 4; | ||
const int heartPin5 = 5; | ||
const int goPin = 6; | ||
const int wavePin = 7; | ||
//const int = 8; | ||
const int blinkPin = 9; | ||
//const int wavePin = 10; | ||
//const int dancePin = 11; | ||
const int dancePin = 12; | ||
//const int = 13; // system pin | ||
//const int = 14; // A0 | ||
//const int = 15; // A1 | ||
//const int = 16; // A2 | ||
//const int = 17; // A3 | ||
//const int = 18; // A4 | ||
//const int = 19; // A5 | ||
|
||
int inCmd; // to manage serial data | ||
int wavestart = 115; | ||
int dancestart = 90; | ||
|
||
void setup() { | ||
// initialize serial communication: | ||
// Serial.begin(9600); // USB wired | ||
Serial.begin(115200); // bluetooth | ||
|
||
waver.attach(wavePin); | ||
waver.write(wavestart); | ||
|
||
dancer.attach(dancePin); | ||
dancer.write(dancestart); | ||
|
||
pinMode(buttonPin, INPUT); | ||
|
||
// initialize the different pins: | ||
pinMode(blinkPin, OUTPUT); | ||
pinMode(goPin, OUTPUT); | ||
pinMode(heartPin3, OUTPUT); | ||
pinMode(heartPin4, OUTPUT); | ||
pinMode(heartPin5, OUTPUT); | ||
} | ||
|
||
void loop() { | ||
|
||
digitalWrite(goPin,HIGH); //ready to receive commands | ||
|
||
// see if there's incoming serial data: | ||
if (Serial.available() > 0) { | ||
// read the oldest byte in the serial buffer: | ||
inCmd = Serial.read(); | ||
|
||
switch (inCmd) { | ||
case 'W': | ||
digitalWrite(goPin,LOW); | ||
waveServo(); | ||
break; | ||
case 'L': | ||
digitalWrite(goPin,LOW); | ||
showLove(); | ||
break; | ||
case 'D': | ||
digitalWrite(goPin,LOW); | ||
happyDance(); | ||
break; | ||
case 'B': | ||
digitalWrite(goPin,LOW); | ||
ledBlinky(5,800); | ||
break; | ||
case 'P': | ||
digitalWrite(goPin,LOW); | ||
ledBlinky(1,1000); | ||
Serial.println("P"); | ||
break; | ||
default: | ||
digitalWrite(goPin,HIGH); | ||
} | ||
} | ||
else { | ||
if (digitalRead(buttonPin) == 1) { | ||
digitalWrite(goPin,LOW); | ||
sendTweet(); | ||
delay(2000); | ||
} | ||
} | ||
} | ||
|
||
void sendTweet() { | ||
// response to button push (or other tweet commands?) - sends random tweet from database | ||
Serial.println("T"); | ||
} | ||
|
||
void waveServo() { | ||
// function to respond to "wave" command | ||
//digitalWrite(wavePin,HIGH); | ||
int sweep = 10; | ||
int right = wavestart+sweep; | ||
int left = wavestart-sweep; | ||
int pos; | ||
int waves = 5; | ||
|
||
for (int i = 0; i < waves; i++) { | ||
for(pos = left; pos < right; pos += 1) { | ||
waver.write(pos); | ||
delay(15); | ||
} | ||
for(pos = right; pos > left; pos -= 1) { | ||
waver.write(pos); | ||
delay(15); | ||
} | ||
} | ||
waver.write(wavestart); | ||
//digitalWrite(wavePin,LOW); | ||
} | ||
|
||
void showLove() { | ||
// function for LED matrix beating heart (?) - response to "love" command | ||
int heartpins[] = { | ||
heartPin3, heartPin4, heartPin5 }; | ||
int numPins = sizeof(heartpins); | ||
int flashes = 3; | ||
|
||
for (int i=0; i < numPins; i++) { | ||
digitalWrite(i, HIGH); | ||
delay(750); | ||
} | ||
|
||
for (int i=0; i < flashes;i++) { | ||
for (int i=0; i < numPins; i++) { | ||
digitalWrite(i, LOW); | ||
} | ||
delay(500); | ||
for (int i=0; i < numPins; i++) { | ||
digitalWrite(i, HIGH); | ||
} | ||
delay(500); | ||
} | ||
|
||
for (int i=numPins; i >= 0; i--) { | ||
digitalWrite(i, LOW); | ||
delay(750); | ||
} | ||
/**** LED TESTING ONLY ******** | ||
* for (int i = 0; i <= 5; i++) { | ||
* digitalWrite(heartPin3,HIGH); | ||
* delay(100); | ||
* digitalWrite(heartPin4,HIGH); | ||
* delay(100); | ||
* digitalWrite(heartPin5,HIGH); | ||
* delay(100); | ||
* digitalWrite(heartPin3,LOW); | ||
* delay(100); | ||
* digitalWrite(heartPin4,LOW); | ||
* delay(100); | ||
* digitalWrite(heartPin5,LOW); | ||
* delay(100); | ||
* } | ||
/******************************/ | ||
} | ||
|
||
void happyDance() { | ||
// function for happy feet dance - response to "dance" command | ||
int sweep = 10; | ||
int right = dancestart+sweep; | ||
int left = dancestart-sweep; | ||
int pos; | ||
int dances = 5; | ||
|
||
for (int i = 0; i < dances; i++) { | ||
for(pos = left; pos < right; pos += 1) { | ||
dancer.write(pos); | ||
delay(25); | ||
} | ||
for(pos = right; pos > left; pos -= 1) { | ||
dancer.write(pos); // tell servo to go to position in variable 'pos' | ||
delay(25); // waits 15ms for the servo to reach the position | ||
} | ||
} | ||
dancer.write(dancestart); | ||
|
||
/**** LED TESTING ONLY ******** | ||
* for (int i = 0; i <= 5; i++) { | ||
* digitalWrite(lfPin,HIGH); | ||
* digitalWrite(dancePin,LOW); | ||
* delay(100); | ||
* digitalWrite(dancePin,HIGH); | ||
* digitalWrite(lfPin,LOW); | ||
* delay(100); | ||
* } | ||
* digitalWrite(dancePin,LOW); | ||
* digitalWrite(lfPin,LOW); | ||
/******************************/ | ||
} | ||
|
||
void ledBlinky(int blinks, int bdel) { | ||
// function to respond to "blink" command | ||
for (int i = 0; i < blinks; i++) { | ||
digitalWrite(blinkPin, HIGH); // set the LED on | ||
delay(bdel); // wait for a second | ||
digitalWrite(blinkPin, LOW); // set the LED off | ||
delay(bdel); // wait for a second | ||
} | ||
} | ||
|
||
void setGo() { | ||
// possible function for testing and setting the "go" light. | ||
digitalWrite(goPin,LOW); | ||
delay(100); | ||
} | ||
|
||
|
||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,131 @@ | ||
@charset "UTF-8"; | ||
/* CSS Document */ | ||
|
||
/* Global CSS */ | ||
body { | ||
font-family: Helvetica, Verdana, Arial; | ||
color: #333333; | ||
} | ||
a { | ||
color: #b82525; | ||
text-decoration: none; | ||
} | ||
h2, h3 { | ||
color: #3636AB; | ||
margin-left: 20px; | ||
margin-bottom: 0; | ||
padding-bottom: 5px; | ||
border-bottom: 1px solid #CDCDCD; | ||
font-size: 14pt; | ||
} | ||
/* End Global CSS */ | ||
|
||
/* Styles for Arthur Main Page*/ | ||
#mainheader { | ||
border-bottom: 1px solid #CDCDCD; | ||
color: #696969; | ||
font-size: 16pt; | ||
} | ||
#maincontent { | ||
width: 75%; | ||
padding: 20px: | ||
margin: 20px; | ||
} | ||
.hash { | ||
margin-left: 5px; | ||
} | ||
.hash p{ | ||
margin-left: 40px; | ||
} | ||
#twitter { | ||
width: 250px; | ||
position: fixed; | ||
top: 40px; | ||
right: 10px; | ||
} | ||
#icon { | ||
width: 250px; | ||
height: 375px; | ||
background-image: url(arthur-small.png); | ||
background-repeat:no-repeat; | ||
background-position:left top; | ||
position: fixed; | ||
bottom: 10px; | ||
right: 10px; | ||
} | ||
#contacts { | ||
position: fixed; | ||
top: 10px; | ||
right: 10px; | ||
} | ||
#footer{ | ||
border-top: 1px solid #CDCDCD; | ||
margin: 10px; | ||
padding: 10px; | ||
font-size: smaller; | ||
color: #898989; | ||
} | ||
/* End Styles for Arthur Main Page*/ | ||
|
||
/* Styles for Arthur Cam */ | ||
#camheader { | ||
z-index:5; | ||
width:90%; | ||
line-height:1.9; | ||
margin: 0 auto; | ||
background-color:rgba(255,255,255,0.9); | ||
padding:10px; | ||
-webkit-box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
-moz-box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
border:1px solid #6A6A6A; | ||
text-align: center; | ||
} | ||
#camheader h1 { | ||
display: inline; | ||
} | ||
ul.thumbs { | ||
display: block; | ||
margin-top: 10px; | ||
list-style: none; | ||
} | ||
.thumbs li { | ||
display: block; | ||
float: left; | ||
margin: 7px; | ||
} | ||
.thumbs img { | ||
border: 1px #cdcdcd solid; | ||
} | ||
.thumbs a:hover img { | ||
filter:alpha(opacity=50); | ||
opacity: 0.6; | ||
} | ||
#galContent { | ||
width: 90%; | ||
margin: 0 auto; | ||
} | ||
#gallery { | ||
width: 100%; | ||
margin-top: 15px; | ||
margin: 0 auto; | ||
} | ||
#gallery img{ | ||
width:230px; | ||
-webkit-box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
-moz-box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
border:1px solid #363636; | ||
margin: 7px; | ||
} | ||
.perma { | ||
font-size: smaller; | ||
margin:0 10px 4px 15px; | ||
text-align: right; | ||
color: #787878; | ||
} | ||
.perma a { | ||
color: #9A9A9A; | ||
} | ||
|
||
/*End Styles for Arthur Cam */ |
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,28 @@ | ||
#page { | ||
width: 100%; | ||
} | ||
#camheader { | ||
width:100%; | ||
line-height:1.9; | ||
margin: 0 auto; | ||
padding: 6px; | ||
text-align: center; | ||
} | ||
#camheader h1 { | ||
display: inline; | ||
} | ||
#galContent { | ||
width: 100%; | ||
margin-bottom: 10px; | ||
} | ||
#gallery img{ | ||
width:85px; | ||
-webkit-box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
-moz-box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
box-shadow:2px 2px 4px rgba(0,0,0,0.3); | ||
border:1px solid #363636; | ||
margin: 2px; | ||
} | ||
.perma { | ||
display: none; | ||
} |
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.