Robot Art Show
Evidence of Work
#include <LiquidCrystal.h> //tells program to include an LCD display
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);//assigns pins 8-13 to the LCD display
int RedPin = 7;//assigns red to pin 7
int GreenPin = 6;//assigns green to pin 6
int BluePin = 5;//assigns blue to pin 5
int speakerPin = 4;//assigns the speaker control to pin 4
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(RedPin,OUTPUT);//sets the red pin to output a signal
pinMode(GreenPin,OUTPUT);//sets green pin to output a signal
pinMode(BluePin,OUTPUT);//sets blue pin to output a signal
lcd.begin(16, 2);
lcd.clear();
pinMode(speakerPin, OUTPUT);//sets the speaker pin to output a signal
}
void loop() {
// put your main code here, to run repeatedly:
lcd.setCursor(0,0);//places cursor at top left
lcd.print("Take on Me");//puts the song title on the screen
green();//should turn the RGB light to green
play('F', 1); //plays an F# for one beat
turnOff ();//should turn off the RGB light
green(); //repeat for all other notes and colors
play('F', 1);
turnOff ();
orange();
play('d', 1);
turnOff ();
red();
play('b', 1);
turnOff ();
play(' ', 1);
red();
play('b', 1);
turnOff ();
play(' ', 1);
yellow();
play('f', 1);
turnOff ();
play(' ', 1);
yellow();
turnOff ();
play('f', 1);
play(' ', 1);
play('f', 1);
play('G', 1);
play('G', 1);
play('a', 1);
play('B', 1);
play('a', 1);
play('a', 1);
play('a', 1);
play('f', 1);
play(' ', 1);
play('d', 1);
play(' ', 1);
play('F', 1);
play(' ', 1);
play('F', 1);
play(' ', 1);
play('F', 1);
play('f', 1);
play('f', 1);
play('F', 1);
play('f', 1);
}
void play( char note, int beats ) {//defines the program "play" to take input from the note and the number of beats
int numNotes = 9;//declares the number of notes
char notes[] = { 'b', 'd', 'f', 'F', 'G', 'a', 'B', ' '};//declares the notes
int frequencies[] = {247, 294, 330, 370, 416, 440, 494, 0};//assigns frequencies to notes
int currentFrequency = 0;//sets starting frequency
int beatLength = 150;//defines the beat length in milliseconds
for (int i = 0; i < numNotes; i++) // check each value in notes from 0 to 9
{
if (notes[i] == note) // does the letter passed to the play function match the letter in the array?
{
currentFrequency = frequencies[i]; // Yes! Set the current frequency to match that note
}
}
tone(speakerPin, currentFrequency, beats * beatLength);
delay(beats* beatLength); //wait for the length of the tone so that it has time to play
delay(50); //a little delay between the notes makes the song sound more natural
}
void red (){
//set the LED pins to values that make red
analogWrite(RedPin, 100);
analogWrite(GreenPin, 0);
analogWrite(BluePin, 0);
}
void orange (){
//set the LED pins to values that make orange
analogWrite(RedPin, 100);
analogWrite(GreenPin, 50);
analogWrite(BluePin, 0);
}
void yellow (){
//set the LED pins to values that make yellow
analogWrite(RedPin, 100);
analogWrite(GreenPin, 100);
analogWrite(BluePin, 0);
}
void green (){
//set the LED pins to values that make green
analogWrite(RedPin, 0);
analogWrite(GreenPin, 100);
analogWrite(BluePin, 0);
}
void cyan (){
//set the LED pins to values that make cyan
analogWrite(RedPin, 0);
analogWrite(GreenPin, 100);
analogWrite(BluePin, 100);
}
void blue (){
//set the LED pins to values that make blue
analogWrite(RedPin, 0);
analogWrite(GreenPin, 0);
analogWrite(BluePin, 100);
}
void magenta (){
//set the LED pins to values that make magenta
analogWrite(RedPin, 100);
analogWrite(GreenPin, 0);
analogWrite(BluePin, 100);
}
void turnOff (){
//set all three LED pins to 0 or OFF
analogWrite(RedPin, 0);
analogWrite(GreenPin, 0);
analogWrite(BluePin, 0);
}
For this project, we had to tackle a set of skills that, unfortunately weren't much of our teachers' area of expertise, rendering the amount of help they could offer to a minimum. Most of the work was done independent of them, as we used kits to learn to assemble circuits and code. Later on, the examples in the kits served as foundations, both in hardware and software. From there, it was up to us to create an art form that could supposedly be enjoyed by humans and robots alike. (Assuming artificial intelligence could grow so advanced that it could appreciate any kind of art. We chose to have our project play the song "Take On Me" by Ah-ha as well as flash an RGB LED corresponding to each note. However, we only managed to code the song audio and the title onto an LCD display.
Content
Big Idea
Electrical and magnetic fields can move charges using force and can be created using electrical circuits.
Topics
I can predict the forces between different electric charges.
I can create an experiment to understand the connection between magnets and electricity.
I can create a model to show the motion and energy of objects in electric or magnetic fields.
I can build a series or parallel circuit, calculate the total resistance, then solve for the the current and voltage using Ohm’s Law (V=ir)
Vocab
charge
to store electrical energy
electrostatic force
attractive or repulsive forces depending on the electrical charge of an object
coulomb's inverse square law
F=ke(q1q2/r2)
electric circuit
a path in which electrons form a voltage or current source flow
voltage
a difference in electrical potential
electric current
the movement of electrons from positive to negative charge
magnetic field
an invisible field surrounding a magnetic object
volts
the unit of measurement of voltage
amperes
a current flow of one coulomb per second
electric field
a field around a charged particle in which it can exert force
electric potential
the work per unit of charge required to move a charge from a reference point to a specified point
Reflection
Yet another success to almost finish off the school year, this project was one of the more difficult as far as problem solving and troubleshooting is concerned. Critical Thinking was needed for this project, and a lot of it. The most difficult part was troubleshooting, and that seemed to be consistent across most groups. Also, my skills as a Conscientious Learner had to present themselves while learning from a kit how to assemble a circuit and and code it to do what I wanted it to.
However, Collaboration over the course of this project left something to be desired, as I was absent some days, and my partner was absent other days. Also, Communication really suffered, as the longest exchanges were usually me asking him to pass me a specific part.