Professional Documents
Culture Documents
//lights
const int RED_PIN = 9; //wire of light is connected to pin 9
const int GREEN_PIN = 6; //wire of light is connected to pin 6
const int BLUE_PIN = 10; //wire of light is connected to pin 10
int DISPLAY_TIME = 100; //how long each color is shown
//music box
//note frequency
//c 262 Hz
//d 294 Hz
//e 330 Hz
//f 349 Hz
//g 392 Hz
//a 440 Hz
//b 494 Hz
//C 523 Hz
//D 311.13 Hz //D means d sharp
//B 246.94 Hz
//A 220 Hz
const int buzzerPin = 8; //wire for buzzer is connected to pin 8
const int songLength = 9; //song length
char notes[] = "eDeDeBdcA"; // notes played in order (fur elise)
int beats[] = {1,1,1,1,1,1,1,1,3}; //number of beats each note is played
int tempo = 300; //how fast each the beat is (tempo)
//word board
#include <LiquidCrystal.h> //this allows the arduino board to write things on the liquid crystal display
LiquidCrystal lcd(12,11,5,4,3,2); //the number of the pins the lcd is plugged into
void setup() //start with these codes
{
// put your setup code here, to run once:
//lights
pinMode(RED_PIN, OUTPUT); //the red pin is being used as an output
pinMode(GREEN_PIN, OUTPUT); //the green pin is being used as an output
pinMode(BLUE_PIN, OUTPUT); //the blue pin is being used as an output
//music box
pinMode(buzzerPin, OUTPUT); //the buzzer pin is being used as an output
//word board
lcd.begin(16, 2); //start typing
lcd.clear(); //clear all words
lcd.setCursor(0,0); //set the cursor
lcd.print(" Robot Art Show "); // write what you want written
lcd.setCursor(0,1); //set the cursor
lcd.print("
"); // write what you want written
}
}
}
//lights
void mainColors() //the writing below in brackets controls the brightness of each bulb
{
digitalWrite(RED_PIN, HIGH);
digitalWrite(GREEN_PIN, HIGH);
digitalWrite(BLUE_PIN, HIGH); //turn on all lights to create white
delay(1000); //pause for a second
digitalWrite(RED_PIN, LOW);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, HIGH); //turn on blue to create blue
delay(1000); //pause for a second
digitalWrite(RED_PIN, HIGH);
digitalWrite(GREEN_PIN, LOW);
digitalWrite(BLUE_PIN, LOW); //turn on red to create red