Useless Machine
This is a blog about our ME Design Lab Project and its design, development, and creation.
Sunday, December 15, 2013
What I Did on the Project (Eddie Dougherty)
I did a lot of the posts to the blog such as the motion study, some of the progress updates, and the SolidWorks pictures, both the parts and assemblies. In addition to adding a lot to the blog I contributed by supplying the Lego's that made up the frame and base of the project. I helped a lot with designing this base, putting it together, and figuring out how and where to place the push buttons and LEDs. Also I wrote one page about the parts of the project I contributed most to for the summary on this project.
What I Did on the Project (Christopher Houston)
I wrote the code for each step within the design process; therefore, any changes to the design I wrote the code for it. Additionally, I wrote a few blog posts, one of which included a video of the working code. Moreover, I wrote a page of the report, which covered the code and how it was implemented. Furthermore, I wrote code to test the individual pieces before we finalized the design to make sure that each part was working properly before we soldered or glued anything. Also, I helped put the base of the design together.
Saturday, December 14, 2013
What I Did on the Project (Peter Marashio)
I came up with the Solid Works designs and the parts. I made them all using Solid Works. I also was in charge of how they would be connected and how it would relate to the proper motion that we needed. I gathered the servo motor and the addition power supply that was required. I also did all the soldering and wiring for the project. I also did one page of the report that explained the Solid Works parts and designs and the problems that arose with them.
Friday, December 13, 2013
Dates Met, and Time Spent Working
Everyone attended every meeting that was held. The meetings were held as follows.
11/15/13 Time Spent Working 3 Hrs.
Solid Works and initial Arduino coding done here.
11/19/13 Time Spent Working 2 Hrs.
Adjusting and submitting the Solid Works parts, adjusting the code as well.
12/6/13 Time Spent Working 5 Hrs.
Gathering the parts and the beginning of building the entire machine.
12/8/13 Time Spent Working 5 Hrs.
The Soldering and hot gluing of the electrical components, and modifying the build to house everything as best as it could.
12/10/13 Time Spent Working 3.5 Hrs.
The Wiring of the board was done as well as adjusting the code to make everything work properly.
12/11/13 Time Spent Working 1.5 Hrs.
Final adjustments were made to the overall project.
Total Time Spent Working: Roughly 20 Hours
Time spent working does not include the lab sections where time was given to work on the project.
11/15/13 Time Spent Working 3 Hrs.
Solid Works and initial Arduino coding done here.
11/19/13 Time Spent Working 2 Hrs.
Adjusting and submitting the Solid Works parts, adjusting the code as well.
12/6/13 Time Spent Working 5 Hrs.
Gathering the parts and the beginning of building the entire machine.
12/8/13 Time Spent Working 5 Hrs.
The Soldering and hot gluing of the electrical components, and modifying the build to house everything as best as it could.
12/10/13 Time Spent Working 3.5 Hrs.
The Wiring of the board was done as well as adjusting the code to make everything work properly.
12/11/13 Time Spent Working 1.5 Hrs.
Final adjustments were made to the overall project.
Total Time Spent Working: Roughly 20 Hours
Time spent working does not include the lab sections where time was given to work on the project.
Thursday, December 12, 2013
Progress Update: Week of the 9th (Final Week)
This week we were able to meet up and put the final parts of our project together. We were able to:
- glue down all buttons and LEDs to the Lego frame
- wired everything to the Arduino board
- Test the code to make sure button presses would change LED lights
- Type a 3 page summary about the project
This next to pictures are what the completed project looks like:
Front View |
Back View |
Project Assembly Motion Study
Here is a motion study of what our project will do. The "E" shaped piece will move back and forth, pressing one button located at one end of the "E", and then another button at the other end.
SolidWorks Assembly
Progress Update: Week of Dec. 2nd
This post is a week late but it highlights all that was completed last week. The group met last Friday to put the project together and test out how the 3D printed parts would work. We ran into a problem however when we realized we were missing a very important part since it wasn't with our other printed pieces. This piece was the wheel that would be attached to the main servo motor and the 3D printed Lego piece. Without it, we were able to connect all the other parts and see how they would function but couldn't put the entire project together. However we did accomplish many things while working on the project that day:
- Putting 3D printed parts together
- soldering wires to push buttons and LEDs
- Building a base and frame for the entire project out of Legos
Here are two pictures of what the project looked like so far,
Sunday, December 8, 2013
Some More Code
We decided to leave the push buttons, since the switches were not able to be pushed by the servo motor. While, the buttons were easier to push than originally expected. So, this is the original code with the motor added to it. We may have to remove the LCD screen, since there may not be enough pins. The new code is posted below with the LCD screen unused, since the servo is taking two of its needed pins:
//#include <LiquidCrystal.h>
#include <Servo.h>
//LiquidCrystal lcd(5,4,3,2,1,0); // Intializing the LCD screen's pin connection
Servo myservo1; // Creates servo objects to control each servo
Servo myservo2;
const int ledPin13 = 13; // Intializing each LED's pin connection
const int ledPin12 = 12;
const int ledPin11 = 11;
const int ledPin10 = 10;
int loopCounter = 0; // Intializing a loop counter
int Mode = 0; // Intializing the mode of each sub-system
int switchPin9 = 9; // Intializing switch pin values
int switchPin8 = 8;
int switchPin7 = 7;
int switchPin6 = 6;
int buttonState1; // Intializing the button's state
int buttonState2;
int buttonState3;
int buttonState4;
int value1; // Intializing debounce values
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;
int value8;
int pos1 = 0; // Intializeing each servo's position
int pos2 = 0;
void setup() {
buttonState1 = digitalRead(switchPin9); // Reads the swithch pins
buttonState2 = digitalRead(switchPin8);
buttonState3 = digitalRead(switchPin7);
buttonState4 = digitalRead(switchPin6);
pinMode(switchPin9, INPUT); // Set the switch pins as input
pinMode(switchPin8, INPUT);
pinMode(switchPin7, INPUT);
pinMode(switchPin6, INPUT);
pinMode(ledPin13, OUTPUT); // LEDs are set as output
pinMode(ledPin12, OUTPUT);
pinMode(ledPin11, OUTPUT);
pinMode(ledPin10, OUTPUT);
myservo1.attach(5); // attaches the servo to pin 5
myservo2.attach(4); // attaches the servo to pin 4
//lcd.begin(16,2);
//lcd.clear();
Serial.begin(9600);
}
void loop(){
value1 = digitalRead(switchPin9); // Read input value and store it
delay(10); // 10 milliseconds delay
value2 = digitalRead(switchPin9); // Reads the input again to check for bounces
if (value1 == value2) { // Make sure intial readings are consistant
if (value1 != buttonState1) { // The button's state changed
if (value1 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 0) {
Mode = 1;
} else {
Mode = Mode;
}
}
}
buttonState1 = value1; // Saves the new state of the variable
}
value3 = digitalRead(switchPin8); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin8); // Reads the input again to check for bounces
if (value3 == value4) { // Make sure intial readings are consistant
if (value3 != buttonState2) { // The button's state changed
if (value3 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 1) {
Mode = 2;
} else {
Mode = Mode;
}
}
}
buttonState2 = value3; // Saves the new state in our variable
}
value5 = digitalRead(switchPin7); // Read input value and store it
delay(10); // 10 milliseconds delay
value6 = digitalRead(switchPin7); // Reads the input again to check for bounces
if (value5 == value6) { // Make sure intial readings are consistant
if (value5 != buttonState3) { // The button's state changed
if (value5 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 2) {
Mode = 3;
} else {
Mode = Mode;
}
}
}
buttonState3 = value5; // Saves the new state of the variable
}
value7 = digitalRead(switchPin6); // Read input value and store it
delay(10); // 10 milliseconds delay
value8 = digitalRead(switchPin6); // Reads the input again to check for bounces
if (value7 == value8) { // Make sure intial readings are consistant
if (value7 != buttonState4) { // The button's state changed
if (value7 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 3) {
loopCounter++; // Adds to loop counter when mode is 0
Mode = 0;
} else {
loopCounter++; // Adds to loop counter when mode is 1
Mode = Mode;
}
}
}
buttonState4 = value7; // Saves the new state of the variable
//Serial.print("Number of Loops : "); // Prints phrase to screen
//Serial.println(loopCounter); // Prints number of loops to LCD screen
}
// save the current state as the last state for next time through the loop
// Lights turn on and off based on the mode indicated
if (Mode == 0) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
for(pos1 = 0; pos1 < 25; pos1 += 1) // goes from 0 degrees to 180 degrees in steps of 1 degree
{
myservo1.write(pos1); // tell servo to go to position in variable 'pos1'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
if (Mode == 1) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
for(pos2 = 0; pos2 < 40; pos2 += 1) // goes from 0 degrees to 180 degrees in steps of 1 degree
{
myservo2.write(pos2); // tell servo to go to position in variable 'pos2'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
if (Mode == 2) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
for(pos1 = 25; pos1 >= 1; pos1 -= 1) // goes from 180 degrees to 0 degrees in steps of 1 degree
{
myservo1.write(pos1); // tell servo to go to position in variable 'pos1'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
if (Mode == 3) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, HIGH);
for(pos2 = 40; pos2 >= 1; pos2 -= 1) // goes from 180 degrees to 0 degrees in steps of 1 degree
{
myservo2.write(pos2); // tell servo to go to position in variable 'pos2'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
}
______________________________________________________________________________
//#include <LiquidCrystal.h>
#include <Servo.h>
//LiquidCrystal lcd(5,4,3,2,1,0); // Intializing the LCD screen's pin connection
Servo myservo1; // Creates servo objects to control each servo
Servo myservo2;
const int ledPin13 = 13; // Intializing each LED's pin connection
const int ledPin12 = 12;
const int ledPin11 = 11;
const int ledPin10 = 10;
int loopCounter = 0; // Intializing a loop counter
int Mode = 0; // Intializing the mode of each sub-system
int switchPin9 = 9; // Intializing switch pin values
int switchPin8 = 8;
int switchPin7 = 7;
int switchPin6 = 6;
int buttonState1; // Intializing the button's state
int buttonState2;
int buttonState3;
int buttonState4;
int value1; // Intializing debounce values
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;
int value8;
int pos1 = 0; // Intializeing each servo's position
int pos2 = 0;
void setup() {
buttonState1 = digitalRead(switchPin9); // Reads the swithch pins
buttonState2 = digitalRead(switchPin8);
buttonState3 = digitalRead(switchPin7);
buttonState4 = digitalRead(switchPin6);
pinMode(switchPin9, INPUT); // Set the switch pins as input
pinMode(switchPin8, INPUT);
pinMode(switchPin7, INPUT);
pinMode(switchPin6, INPUT);
pinMode(ledPin13, OUTPUT); // LEDs are set as output
pinMode(ledPin12, OUTPUT);
pinMode(ledPin11, OUTPUT);
pinMode(ledPin10, OUTPUT);
myservo1.attach(5); // attaches the servo to pin 5
myservo2.attach(4); // attaches the servo to pin 4
//lcd.begin(16,2);
//lcd.clear();
Serial.begin(9600);
}
void loop(){
value1 = digitalRead(switchPin9); // Read input value and store it
delay(10); // 10 milliseconds delay
value2 = digitalRead(switchPin9); // Reads the input again to check for bounces
if (value1 == value2) { // Make sure intial readings are consistant
if (value1 != buttonState1) { // The button's state changed
if (value1 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 0) {
Mode = 1;
} else {
Mode = Mode;
}
}
}
buttonState1 = value1; // Saves the new state of the variable
}
value3 = digitalRead(switchPin8); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin8); // Reads the input again to check for bounces
if (value3 == value4) { // Make sure intial readings are consistant
if (value3 != buttonState2) { // The button's state changed
if (value3 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 1) {
Mode = 2;
} else {
Mode = Mode;
}
}
}
buttonState2 = value3; // Saves the new state in our variable
}
value5 = digitalRead(switchPin7); // Read input value and store it
delay(10); // 10 milliseconds delay
value6 = digitalRead(switchPin7); // Reads the input again to check for bounces
if (value5 == value6) { // Make sure intial readings are consistant
if (value5 != buttonState3) { // The button's state changed
if (value5 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 2) {
Mode = 3;
} else {
Mode = Mode;
}
}
}
buttonState3 = value5; // Saves the new state of the variable
}
value7 = digitalRead(switchPin6); // Read input value and store it
delay(10); // 10 milliseconds delay
value8 = digitalRead(switchPin6); // Reads the input again to check for bounces
if (value7 == value8) { // Make sure intial readings are consistant
if (value7 != buttonState4) { // The button's state changed
if (value7 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 3) {
loopCounter++; // Adds to loop counter when mode is 0
Mode = 0;
} else {
loopCounter++; // Adds to loop counter when mode is 1
Mode = Mode;
}
}
}
buttonState4 = value7; // Saves the new state of the variable
//Serial.print("Number of Loops : "); // Prints phrase to screen
//Serial.println(loopCounter); // Prints number of loops to LCD screen
}
// save the current state as the last state for next time through the loop
// Lights turn on and off based on the mode indicated
if (Mode == 0) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
for(pos1 = 0; pos1 < 25; pos1 += 1) // goes from 0 degrees to 180 degrees in steps of 1 degree
{
myservo1.write(pos1); // tell servo to go to position in variable 'pos1'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
if (Mode == 1) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
for(pos2 = 0; pos2 < 40; pos2 += 1) // goes from 0 degrees to 180 degrees in steps of 1 degree
{
myservo2.write(pos2); // tell servo to go to position in variable 'pos2'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
if (Mode == 2) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
for(pos1 = 25; pos1 >= 1; pos1 -= 1) // goes from 180 degrees to 0 degrees in steps of 1 degree
{
myservo1.write(pos1); // tell servo to go to position in variable 'pos1'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
if (Mode == 3) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, HIGH);
for(pos2 = 40; pos2 >= 1; pos2 -= 1) // goes from 180 degrees to 0 degrees in steps of 1 degree
{
myservo2.write(pos2); // tell servo to go to position in variable 'pos2'
delay(15); // waits 15 milliseconds for the servo to reach the position
}
}
}
Tuesday, November 26, 2013
Finalized SolidWorks Parts
http://sullivan-22-201-fall2013.blogspot.com/
Sunday, November 24, 2013
Progress Update: Week of Nov. 18th
We all met together this week for 3 hours and fixed the code/board problems from the previous week. And have decided to work on altering the code for switches, which will be posted sometime next week. The reason behind the change is have less wiring and to achieve the same result. Also, we believe it would be easier for the motors to push the switch than a push button, which would result in less alterations needed later. Additionally, we decided to get our own Lego pieces and combine it with the parts from Solidworks. Finally the working code is listed below and a link to Github to comment:
https://github.com/RubeGoldberg/22.201-802-ChrisPeterEddie.wiki.git
https://github.com/RubeGoldberg/22.201-802-ChrisPeterEddie.wiki.git
______________________________________________________________________________
#include <LiquidCrystal.h>
#include <Servo.h>
LiquidCrystal lcd(5,4,3,2,1,0); // Intializing the LCD screen's pin connection
const int ledPin13 = 13; // Intializing each LED's pin connection
const int ledPin12 = 12;
const int ledPin11 = 11;
const int ledPin10 = 10;
int loopCounter = 0; // Intializing a loop counter
int Mode = 0; // Intializing the mode of each sub-system
int switchPin9 = 9; // Intializing switch pin values
int switchPin8 = 8;
int switchPin7 = 7;
int switchPin6 = 6;
int buttonState1; // Intializing the button's state
int buttonState2;
int buttonState3;
int buttonState4;
int value1; // Intializing debounce values
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;
int value8;
void setup() {
buttonState1 = digitalRead(switchPin9); // Reads the swithch pins
buttonState2 = digitalRead(switchPin8);
buttonState3 = digitalRead(switchPin7);
buttonState4 = digitalRead(switchPin6);
pinMode(switchPin9, INPUT); // Set the switch pins as input
pinMode(switchPin8, INPUT);
pinMode(switchPin7, INPUT);
pinMode(switchPin6, INPUT);
pinMode(ledPin13, OUTPUT); // LEDs are set as output
pinMode(ledPin12, OUTPUT);
pinMode(ledPin11, OUTPUT);
pinMode(ledPin10, OUTPUT);
lcd.begin(16,2);
lcd.clear();
Serial.begin(9600);
}
void loop(){
value1 = digitalRead(switchPin9); // Read input value and store it
delay(10); // 10 milliseconds delay
value2 = digitalRead(switchPin9); // Reads the input again to check for bounces
if (value1 == value2) { // Make sure intial readings are consistant
if (value1 != buttonState1) { // The button's state changed
if (value1 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 0) {
Mode = 1;
} else {
Mode = Mode;
}
}
}
buttonState1 = value1; // Saves the new state of the variable
}
value3 = digitalRead(switchPin8); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin8); // Reads the input again to check for bounces
if (value3 == value4) { // Make sure intial readings are consistant
if (value3 != buttonState2) { // The button's state changed
if (value3 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 1) {
Mode = 2;
} else {
Mode = Mode;
}
}
}
buttonState2 = value3; // Saves the new state in our variable
}
value5 = digitalRead(switchPin7); // Read input value and store it
delay(10); // 10 milliseconds delay
value6 = digitalRead(switchPin7); // Reads the input again to check for bounces
if (value5 == value6) { // Make sure intial readings are consistant
if (value5 != buttonState3) { // The button's state changed
if (value5 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 2) {
Mode = 3;
} else {
Mode = Mode;
}
}
}
buttonState3 = value5; // Saves the new state of the variable
}
value7 = digitalRead(switchPin6); // Read input value and store it
delay(10); // 10 milliseconds delay
value8 = digitalRead(switchPin6); // Reads the input again to check for bounces
if (value7 == value8) { // Make sure intial readings are consistant
if (value7 != buttonState4) { // The button's state changed
if (value7 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 3) {
loopCounter++; // Adds to loop counter when mode is 0
Mode = 0;
} else {
loopCounter++; // Adds to loop counter when mode is 1
Mode = Mode;
}
}
}
buttonState4 = value7; // Saves the new state of the variable
Serial.print("Number of Loops : "); // Prints phrase to screen
Serial.println(loopCounter); // Prints number of loops to LCD screen
}
// save the current state as the last state for next time through the loop
// Lights turn on and off based on the mode indicated
if (Mode == 0) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, HIGH);
}
if (Mode == 1) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, HIGH);
}
if (Mode == 2) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, HIGH);
}
if (Mode == 3) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, LOW);
}
}
#include <LiquidCrystal.h>
#include <Servo.h>
LiquidCrystal lcd(5,4,3,2,1,0); // Intializing the LCD screen's pin connection
const int ledPin13 = 13; // Intializing each LED's pin connection
const int ledPin12 = 12;
const int ledPin11 = 11;
const int ledPin10 = 10;
int loopCounter = 0; // Intializing a loop counter
int Mode = 0; // Intializing the mode of each sub-system
int switchPin9 = 9; // Intializing switch pin values
int switchPin8 = 8;
int switchPin7 = 7;
int switchPin6 = 6;
int buttonState1; // Intializing the button's state
int buttonState2;
int buttonState3;
int buttonState4;
int value1; // Intializing debounce values
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;
int value8;
void setup() {
buttonState1 = digitalRead(switchPin9); // Reads the swithch pins
buttonState2 = digitalRead(switchPin8);
buttonState3 = digitalRead(switchPin7);
buttonState4 = digitalRead(switchPin6);
pinMode(switchPin9, INPUT); // Set the switch pins as input
pinMode(switchPin8, INPUT);
pinMode(switchPin7, INPUT);
pinMode(switchPin6, INPUT);
pinMode(ledPin13, OUTPUT); // LEDs are set as output
pinMode(ledPin12, OUTPUT);
pinMode(ledPin11, OUTPUT);
pinMode(ledPin10, OUTPUT);
lcd.begin(16,2);
lcd.clear();
Serial.begin(9600);
}
void loop(){
value1 = digitalRead(switchPin9); // Read input value and store it
delay(10); // 10 milliseconds delay
value2 = digitalRead(switchPin9); // Reads the input again to check for bounces
if (value1 == value2) { // Make sure intial readings are consistant
if (value1 != buttonState1) { // The button's state changed
if (value1 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 0) {
Mode = 1;
} else {
Mode = Mode;
}
}
}
buttonState1 = value1; // Saves the new state of the variable
}
value3 = digitalRead(switchPin8); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin8); // Reads the input again to check for bounces
if (value3 == value4) { // Make sure intial readings are consistant
if (value3 != buttonState2) { // The button's state changed
if (value3 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 1) {
Mode = 2;
} else {
Mode = Mode;
}
}
}
buttonState2 = value3; // Saves the new state in our variable
}
value5 = digitalRead(switchPin7); // Read input value and store it
delay(10); // 10 milliseconds delay
value6 = digitalRead(switchPin7); // Reads the input again to check for bounces
if (value5 == value6) { // Make sure intial readings are consistant
if (value5 != buttonState3) { // The button's state changed
if (value5 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 2) {
Mode = 3;
} else {
Mode = Mode;
}
}
}
buttonState3 = value5; // Saves the new state of the variable
}
value7 = digitalRead(switchPin6); // Read input value and store it
delay(10); // 10 milliseconds delay
value8 = digitalRead(switchPin6); // Reads the input again to check for bounces
if (value7 == value8) { // Make sure intial readings are consistant
if (value7 != buttonState4) { // The button's state changed
if (value7 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 3) {
loopCounter++; // Adds to loop counter when mode is 0
Mode = 0;
} else {
loopCounter++; // Adds to loop counter when mode is 1
Mode = Mode;
}
}
}
buttonState4 = value7; // Saves the new state of the variable
Serial.print("Number of Loops : "); // Prints phrase to screen
Serial.println(loopCounter); // Prints number of loops to LCD screen
}
// save the current state as the last state for next time through the loop
// Lights turn on and off based on the mode indicated
if (Mode == 0) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, HIGH);
}
if (Mode == 1) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, HIGH);
}
if (Mode == 2) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, HIGH);
}
if (Mode == 3) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, LOW);
}
}
Sunday, November 17, 2013
Progress Update: Week of Nov. 11th
This week, the week of November 11th, our group has made significant progress on our project. We met on Thursday, November 14th and decided to work on sections individually and then compile the work. We have finalized the design for the motor housing piece in SolidWorks and posted it to the blog. We also have begun the coding for the operation of the mechanism using the Arduino Board. This is just a basic code to start off and its purpose is to make the push buttons correspond with the LEDs. The construction of the wiring on the Arduino Board was also started this week, and the group has begun to understand how we plan to wire our mechanism. Furthermore, here is a link to the code thus far: https://github.com/RubeGoldberg/22.201-802-ChrisPeterEddie/wiki/Intial-Code#include--1, to comment on or if you have suggestions. It is also listed below.
______________________________________________________________________________
#include <LiquidCrystal.h>
#include <Servo.h>
LiquidCrystal lcd(5,4,3,2,1,0); // Intializing the LCD screen's pin connection
const int ledPin13 = 13; // Intializing each LED's pin connection
const int ledPin12 = 12;
const int ledPin11 = 11;
const int ledPin10 = 10;
int loopCounter = 0; // Intializing a loop counter
int Mode = 0; // Intializing the mode of each sub-system
int switchPin9 = 9; // Intializing switch pin values
int switchPin8 = 8;
int switchPin7 = 7;
int switchPin6 = 6;
int buttonState1; // Intializing the button's state
int buttonState2;
int buttonState3;
int buttonState4;
int value1; // Intializing debounce values
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;
int value8;
void setup() {
buttonState1 = digitalRead(switchPin9); // Reads the swithch pins
buttonState2 = digitalRead(switchPin8);
buttonState3 = digitalRead(switchPin7);
buttonState4 = digitalRead(switchPin6);
pinMode(switchPin9, INPUT); // Set the switch pins as input
pinMode(switchPin8, INPUT);
pinMode(switchPin7, INPUT);
pinMode(switchPin6, INPUT);
pinMode(ledPin13, OUTPUT); // LEDs are set as output
pinMode(ledPin12, OUTPUT);
pinMode(ledPin11, OUTPUT);
pinMode(ledPin10, OUTPUT);
lcd.begin(16,2);
lcd.clear();
Serial.begin(9600);
}
void loop(){
value1 = digitalRead(switchPin9); // Read input value and store it
delay(10); // 10 milliseconds delay
value2 = digitalRead(switchPin9); // Reads the input again to check for bounces
if (value1 == value2) { // Make sure intial readings are consistant
if (value1 != buttonState1) { // The button's state changed
if (value1 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 0) {
Mode = 1;
} else {
Mode = Mode;
}
}
}
buttonState1 = value1; // Saves the new state of the variable
}
value3 = digitalRead(switchPin8); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin8); // Reads the input again to check for bounces
if (value3 == value4) { // Make sure intial readings are consistant
if (value3 != buttonState2) { // The button's state changed
if (value3 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 1) {
Mode = 2;
} else {
Mode = Mode;
}
}
}
buttonState2 = value3; // Saves the new state in our variable
}
value5 = digitalRead(switchPin7); // Read input value and store it
delay(10); // 10 milliseconds delay
value6 = digitalRead(switchPin7); // Reads the input again to check for bounces
if (value5 == value6) { // Make sure intial readings are consistant
if (value5 != buttonState3) { // The button's state changed
if (value5 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 2) {
Mode = 3;
} else {
Mode = Mode;
}
}
}
buttonState3 = value5; // Saves the new state of the variable
}
value7 = digitalRead(switchPin6); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin6); // Reads the input again to check for bounces
if (value7 == value8) { // Make sure intial readings are consistant
if (value7 != buttonState4) { // The button's state changed
if (value7 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 3) {
loopCounter++; // Adds to loop counter when mode is 0
Mode = 0;
} else {
loopCounter++; // Adds to loop counter when mode is 1
Mode = Mode;
}
}
}
buttonState4 = value7; // Saves the new state of the variable
Serial.print("Number of Loops : "); // Prints phrase to screen
Serial.println(loopCounter); // Prints number of loops to LCD screen
}
// save the current state as the last state for next time through the loop
// Lights turn on and off based on the mode indicated
if (Mode == 0) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
}
if (Mode == 1) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
}
if (Mode == 2) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, LOW);
}
if (Mode == 3) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, HIGH);
}
}
______________________________________________________________________________
#include <LiquidCrystal.h>
#include <Servo.h>
LiquidCrystal lcd(5,4,3,2,1,0); // Intializing the LCD screen's pin connection
const int ledPin13 = 13; // Intializing each LED's pin connection
const int ledPin12 = 12;
const int ledPin11 = 11;
const int ledPin10 = 10;
int loopCounter = 0; // Intializing a loop counter
int Mode = 0; // Intializing the mode of each sub-system
int switchPin9 = 9; // Intializing switch pin values
int switchPin8 = 8;
int switchPin7 = 7;
int switchPin6 = 6;
int buttonState1; // Intializing the button's state
int buttonState2;
int buttonState3;
int buttonState4;
int value1; // Intializing debounce values
int value2;
int value3;
int value4;
int value5;
int value6;
int value7;
int value8;
void setup() {
buttonState1 = digitalRead(switchPin9); // Reads the swithch pins
buttonState2 = digitalRead(switchPin8);
buttonState3 = digitalRead(switchPin7);
buttonState4 = digitalRead(switchPin6);
pinMode(switchPin9, INPUT); // Set the switch pins as input
pinMode(switchPin8, INPUT);
pinMode(switchPin7, INPUT);
pinMode(switchPin6, INPUT);
pinMode(ledPin13, OUTPUT); // LEDs are set as output
pinMode(ledPin12, OUTPUT);
pinMode(ledPin11, OUTPUT);
pinMode(ledPin10, OUTPUT);
lcd.begin(16,2);
lcd.clear();
Serial.begin(9600);
}
void loop(){
value1 = digitalRead(switchPin9); // Read input value and store it
delay(10); // 10 milliseconds delay
value2 = digitalRead(switchPin9); // Reads the input again to check for bounces
if (value1 == value2) { // Make sure intial readings are consistant
if (value1 != buttonState1) { // The button's state changed
if (value1 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 0) {
Mode = 1;
} else {
Mode = Mode;
}
}
}
buttonState1 = value1; // Saves the new state of the variable
}
value3 = digitalRead(switchPin8); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin8); // Reads the input again to check for bounces
if (value3 == value4) { // Make sure intial readings are consistant
if (value3 != buttonState2) { // The button's state changed
if (value3 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 1) {
Mode = 2;
} else {
Mode = Mode;
}
}
}
buttonState2 = value3; // Saves the new state in our variable
}
value5 = digitalRead(switchPin7); // Read input value and store it
delay(10); // 10 milliseconds delay
value6 = digitalRead(switchPin7); // Reads the input again to check for bounces
if (value5 == value6) { // Make sure intial readings are consistant
if (value5 != buttonState3) { // The button's state changed
if (value5 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 2) {
Mode = 3;
} else {
Mode = Mode;
}
}
}
buttonState3 = value5; // Saves the new state of the variable
}
value7 = digitalRead(switchPin6); // Read input value and store it
delay(10); // 10 milliseconds delay
value4 = digitalRead(switchPin6); // Reads the input again to check for bounces
if (value7 == value8) { // Make sure intial readings are consistant
if (value7 != buttonState4) { // The button's state changed
if (value7 == LOW) { // Check if button is pressed, then flip mode after use
if (Mode == 3) {
loopCounter++; // Adds to loop counter when mode is 0
Mode = 0;
} else {
loopCounter++; // Adds to loop counter when mode is 1
Mode = Mode;
}
}
}
buttonState4 = value7; // Saves the new state of the variable
Serial.print("Number of Loops : "); // Prints phrase to screen
Serial.println(loopCounter); // Prints number of loops to LCD screen
}
// save the current state as the last state for next time through the loop
// Lights turn on and off based on the mode indicated
if (Mode == 0) {
digitalWrite(ledPin13, HIGH);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
}
if (Mode == 1) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, HIGH);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, LOW);
}
if (Mode == 2) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, HIGH);
digitalWrite(ledPin10, LOW);
}
if (Mode == 3) {
digitalWrite(ledPin13, LOW);
digitalWrite(ledPin12, LOW);
digitalWrite(ledPin11, LOW);
digitalWrite(ledPin10, HIGH);
}
}
Thursday, November 14, 2013
Wiring Arduino Board Buttons
Here is a picture of the wiring our group has done for the button part of the Arduino. Here we have four push buttons with resistors on each and they have been wired to their respective pins.
Wiring Arduino Board
Here is a picture of the Arduino wiring of the LEDs for the mechanism. The LEDs are wired through pins 9 through 12. Here you can see there are four lights wired to the board with 330 ohm resistors.
The Housing Compartment of the Motor
We plan to place a motor in the cut out portion of the "C" the rotating portion will stick out and the wires will be run through the slot in the back of the "C" which will connect to the Arduino. This can be seen better in the picture below.
This is the back of the "C" part.
The volume of this part is approximately 0.57 cubic inches, which should leave pleanty of material to create the other parts to house everything in. Otherwise this will have to be changed.
The Original Post
Our project will consist of a bar that when a button is pressed will begin to move towards the left. At this same time there is an LED next to the button which lights up. Once the bar moves and hits the button it stops and the light turns off. Then there is a light off to the side of the project that lights up. Next to this light there is another push button. When this light turns on a servo begins to turn towards the button and when pressed the light above it turns off, and another light on the opposite side of the bar turns on. At this time the bar moves towards the LED,next to this LED is another push button. Then once the bar comes in contact with the push button the LED turns off and the bar stops moving. Then, silmutaneously, there is another LED on the opposite side of the push button that turns on and the servo begins to turn towards it where there is another push button. Once the servo comes in contact with the button the light turns off and the entire process repeats.
This project is brought to you by Christopher Houston, Eddie Dougherty, and Peter Marashio. The parts will be made out of plastic and designed using Solidworks. The electronic portion will be run using an Arduino board and Arduino programming.
This project is brought to you by Christopher Houston, Eddie Dougherty, and Peter Marashio. The parts will be made out of plastic and designed using Solidworks. The electronic portion will be run using an Arduino board and Arduino programming.
Well... The original blog email was forgotten.
I, Peter Marashio, messed up when creating the original blog post. I forgot the username and password. So the following post will be about what was posted last week.
Subscribe to:
Posts (Atom)