Saturday, November 23, 2013

Team Meeting 11/2213

We've come up with the circuit and code needed to run our design. A push button is used to turn on the system, an LED inticating its active, then a potentiometer then controls the speed of the motor driving the axles.

Here is the Circut:


The code:

const int buttonPin =  1;
int potpin = A0;
int motorpin = 4;
int analogread = 0;
int potvalue = 0;
int motorvalue = 0;
boolean currentState = LOW;
boolean lastState    = LOW;
boolean stateChange  = false;
int currentButton = 0;
int lastButton    = 2;
int ledArray[] = {13}; // setup
void setup() { 
pinMode(buttonPin, INPUT); 
for (int i=0; i<1; i++){   
pinMode(ledArray[i],OUTPUT); 
Serial.begin(9600);
pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(10, OUTPUT);
}  // main loop
void loop(){
 potvalue = analogRead(potpin);
if(potvalue <= 600 && potvalue >= 400){
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
}
else{
  if(potvalue <= 800 && potvalue >= 601){
    digitalWrite(8, LOW);
    digitalWrite(9, HIGH);
    digitalWrite(10, LOW);
  }
  else{
    if(potvalue <= 1023 && potvalue >= 801){
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      digitalWrite(10, HIGH);
    }
  }


  currentState = debounceButton(); 
stateChange = checkForChange(currentState, lastState); 
currentButton = getButtonNumber(lastButton, currentState, stateChange); 
indicatorLight(currentButton); 
lastState  = currentState; 
lastButton = currentButton;
}  // function debounceButton
boolean debounceButton(){ 
boolean firstCheck   = LOW; 
boolean secondCheck  = LOW; 
boolean current = LOW;   
firstCheck  = digitalRead(buttonPin); 
delay(50); 
secondCheck = digitalRead(buttonPin);   
if (firstCheck == secondCheck){   
current = firstCheck; 
return current;
} // function checkForChange
boolean checkForChange(boolean current, boolean last){ 
boolean change;   
if (current != last){   
change = true; 
else { 
change = false; 
}   
return change;
}      // function getButtonNumber
int getButtonNumber(int button, boolean state, boolean change){ 
if (change == true && state == LOW){   
button++;   
if (button > 1){     
button = 0;   
}   
Serial.println(button); 
return button;
}
int motorspeed(int potvalue, int mororvalue){
  potvalue = analogRead(potpin);
  motorvalue = map(potvalue, 0, 1023, 0, 255);
  Serial.print(motorvalue);
}
 
 
void indicatorLight(int button){ 
for (int i=0; i<1; i++) {   
digitalWrite(ledArray[i], LOW);

digitalWrite(ledArray[button], HIGH);
if(button == 0){
potvalue = analogRead(potpin); 
 motorvalue = map(potvalue, 0, 1023, 0, 255);
 analogWrite(motorpin, motorvalue); 
 Serial.print("potentiometer = " );    
 Serial.print(potvalue);
 Serial.print("\t motor = ");
 Serial.println(motorvalue);
 delay(2);

}
else{
  analogWrite(motorpin, 0);
  digitalWrite(8, LOW);
  digitalWrite(9,LOW);
  digitalWrite(10, LOW);
}


    }


Couldn't get Github to work :(

Hours Logged - week/total
Sean Hatch - 4/8
Alex De Sena -  4/8
Mike Lustwerk - 4/9
Richard Silk - 4/8

Thursday, November 21, 2013

Assembly

This the solidworks assembly for our project. There is no wheels attached to the axles so the gears are visible druing the animation. There will be a caster wheel on the end opposite the axles, mounted underneath the base, to aloow it to move. This means we are going with the 3 wheeled aprroach.

Monday, November 18, 2013

Change in Plans

The LCD we were planning to use, is no longer part of the plan. We will now be just using the LEDs as an indication of the program functioning and the speed of the motor. A new video will be uploaded soon showing the new program in action. The next full group meeting is later this week.

Friday, November 15, 2013

Group Meeting 11-15-2013

We met today to get most of the intial coding done for our porject, seen here is the lcd portion.

   https://github.com/12alex34/INITIALCODE/blob/master/x

Heres a video of the coding in action, we dont have motor yet so that could be no tested and we are still working out many of the kinks in the system.

 
 
Hours Logged this week/total:
 
Sean Hatch- 4/4
Alex De Sena- 4/4
Mike Lustwerk- 5/5
Richard Silk- 4/4
 


Thursday, November 14, 2013

Preliminary Design

Here is a sketch of the basic concept we wish to achieve.
 
 
Made Of printed Plastic
-Potentiometer controlled speed
-Push Button directions
-LEDs display direction
-LCD diplays Speed or power input
 

Tuesday, November 12, 2013

Initial Plans

We have come up with an idea we wish to flesh out, a small 4 or 3 wheeled car which can travel in two directions and change its speed and direction based on several analog inputs.