Midterm Conclusion

In the end, although we got very close to accomplishing our task, we were never able to complete the fully functional moving plant pot that we desired. In the second prototype we were actually able to fit most of the technology inside a plastic plant pot but it was impossible to control. Everything was hot glued within the enclosure and nothing could be manipulated easily. In the end, the furtherest we got is we were able to move the contraption based on solar energy and we were able to lay down the code that would allow two photosensors to detect light from opposite ends and to tell the program to move towards the brightest light – but we were not actually able to accomplish this in the physical sense, which of course is the most important.

The following code controls the direction of the plant pot motor by using two photo resistors for the left and right motion of the contraption. If the difference in voltages is not significant, the vehicle will remain in one place and charge the battery.

int rightSensor = 0;
int leftSensor = 0;
int sensitivity = 1;

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
rightSensor = analogRead(0);
leftSensor = analogRead(1);
Serial.print(”R “);
Serial.print(rightSensor, DEC);
Serial.print(” “);
Serial.print(”L “);
Serial.println(leftSensor, DEC);
delay(10);
if (rightSensor > (leftSensor + sensitivity)){
Serial.println(”going right…”);
}
else if (leftSensor > (rightSensor + sensitivity)){
Serial.println(”going left…”);
}
else {
Serial.println(”staying put”);
}
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s