Project Overview:
For this project we were tasked with coding on Arduino a robot art show. We used a red board and normal codes to make lights, noises, and movement.
What we created:
At the beginning of this project we coded an entire song. We coded the song "I got this feeling" by Bruno Mars. However after coding the entire song our teacher told us it wasn't creative enough. (even though that is what every other group did) So then we moved on and tried to code a game. Our game would work by a series of lights going in order and when it hits the green light you would press a button to make it go onto the next level which then would go faster. However we were not successful with making it work. We got the lights to go on and off and the button to randomly turn off all the lights but the game itself was unsuccessful.
Our code:
Game code
const int button1Pin =7; //establishing pin values
const int ledPin = 13; //estblishing pin values
void setup()
{
pinMode(13,OUTPUT); //getting ready to send electricity through pin 13
pinMode(12,OUTPUT); //getting ready to send electricity through pin 12
pinMode(11,OUTPUT); //getting ready to send electricity through pin 11
pinMode(10,OUTPUT); //getting ready to send electricity through pin 10
pinMode(9,OUTPUT); //getting ready to send electricity through pin 9
pinMode(8,OUTPUT); //getting ready to send electricity through pin 8
pinMode(button1Pin,INPUT); //getting ready to send electricity through pin 7
}
void loop()
{
int button1State;
button1State=digitalRead(button1Pin); //turn on button
digitalWrite(13, HIGH); //pin 13 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(13, LOW); //pin 13 turn off
digitalWrite(12, HIGH); //pin 12 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(12, LOW); //pin 12 turn off
digitalWrite(11, HIGH); //pin 11 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(11, LOW); //pin 11 turn off
digitalWrite(10, HIGH); //pin 10 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(10, LOW); //pin 10 turn off
digitalWrite(9, HIGH); //pin 9 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(9, LOW); //pin 9 turn off
digitalWrite(8, HIGH); //pin 8 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(8, LOW); //pin
if (button1State == LOW) //if button is being pushedc following code happens
{{digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(100);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(100);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(100);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(100);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
delay(100);
digitalWrite(8, LOW);
}}
else //if b utton isnt being pushed light turns off
{
digitalWrite(13, LOW); //turn of pin 13
digitalWrite(12, LOW); //turn off pin 12
digitalWrite(11, LOW); //turn off pin 118
digitalWrite(10, LOW); //turn off pin 10
digitalWrite(9, LOW); //turn off pin 9
digitalWrite(8, LOW); //turn off pin
delay (99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
}
if (button1State == LOW)
{digitalWrite(13, HIGH);
delay(75);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(75);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(75);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(75);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(75);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
delay(75);
digitalWrite(8, LOW);
}
else
{
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
delay (999999999999999999999999999);
}}
const int ledPin = 13; //estblishing pin values
void setup()
{
pinMode(13,OUTPUT); //getting ready to send electricity through pin 13
pinMode(12,OUTPUT); //getting ready to send electricity through pin 12
pinMode(11,OUTPUT); //getting ready to send electricity through pin 11
pinMode(10,OUTPUT); //getting ready to send electricity through pin 10
pinMode(9,OUTPUT); //getting ready to send electricity through pin 9
pinMode(8,OUTPUT); //getting ready to send electricity through pin 8
pinMode(button1Pin,INPUT); //getting ready to send electricity through pin 7
}
void loop()
{
int button1State;
button1State=digitalRead(button1Pin); //turn on button
digitalWrite(13, HIGH); //pin 13 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(13, LOW); //pin 13 turn off
digitalWrite(12, HIGH); //pin 12 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(12, LOW); //pin 12 turn off
digitalWrite(11, HIGH); //pin 11 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(11, LOW); //pin 11 turn off
digitalWrite(10, HIGH); //pin 10 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(10, LOW); //pin 10 turn off
digitalWrite(9, HIGH); //pin 9 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(9, LOW); //pin 9 turn off
digitalWrite(8, HIGH); //pin 8 turn on
delay(1000); //delay of light going on and off 1000 millasecounds
digitalWrite(8, LOW); //pin
if (button1State == LOW) //if button is being pushedc following code happens
{{digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(100);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(100);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(100);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(100);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
delay(100);
digitalWrite(8, LOW);
}}
else //if b utton isnt being pushed light turns off
{
digitalWrite(13, LOW); //turn of pin 13
digitalWrite(12, LOW); //turn off pin 12
digitalWrite(11, LOW); //turn off pin 118
digitalWrite(10, LOW); //turn off pin 10
digitalWrite(9, LOW); //turn off pin 9
digitalWrite(8, LOW); //turn off pin
delay (99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
}
if (button1State == LOW)
{digitalWrite(13, HIGH);
delay(75);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(75);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(75);
digitalWrite(11, LOW);
digitalWrite(10, HIGH);
delay(75);
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
delay(75);
digitalWrite(9, LOW);
digitalWrite(8, HIGH);
delay(75);
digitalWrite(8, LOW);
}
else
{
digitalWrite(13, LOW);
digitalWrite(12, LOW);
digitalWrite(11, LOW);
digitalWrite(10, LOW);
digitalWrite(9, LOW);
digitalWrite(8, LOW);
delay (999999999999999999999999999);
}}
Concepts:
Circuit |
Series |
A loop of conductive material from one power source terminal to another
|
An electrical circuit in which the electricity passes through each circuit element in order. Resistance equation for series: r(total)= r(1)+r(2)+r(3)...
ParallelsA closed electrical circuit in which the current is divided into two or more paths and then returns via a common path to complete the circuit Resistance equation for parallels: 1/r(total)=1/r(1)+1/r(2)+1/r(3)...
Bread BoardA board for making an experimental model of an electrical circuit.
|
CurrentAn electric current is a flow of electric charge
VoltageAn electromotive force or potential difference expressed in volts.
Resistance and ResistorsResistance is an electrical quantity that measures how the device or material reduces the electric current flow through it. The resistance is measured in units of ohms (Ω). Resistors are put in to change the flow of energy
|
Reflection:
For this project I felt it didn't work out the best. Zoe and I really didn't know anything about coding and our teacher was reluctant to help us because we started the project early. My group really struggled through this project because after coding an entire song and being told it wasn't good enough we felt really discouraged. So after that we didn't have a high work ethic cause we were just frustrated with our teacher for making us restart. I defiantly thought that was a low, another low was when we didn't get our game to work. After working on the code for our game it just wasn't working and we ran out of time so never got to finish it. A high of our project was the beginning when we got our song code to work and play the entire song. Overall I really didn't like this project, thought we were denied the help with what we needed, and wasn't happy with our final project.