Today we made drastic improvements on our project! Rather than requiring the two wires to be touched manually for a launch, we experimented with using a relay and a button in order to control the firing mechanism. The code for this follows this post. When this code and setup succeed, we proceeded to test many different pressure levels with Whoppers, ranging from 30 psi up to 80 psi. The video above is a high speed video shot on an iPhone 5s at 120 frames per second. A piece of paper towel was inserted to the barrel of the cannon prior to loading the Whopper to create a more air tight seal. The pressure loading on this shot was 80 psi. Although this is highly unrealistic for catching a Whopper in ones mouth, we were intrigued and decided to try high pressures such as this. It should also be noted that the paper towel is not necessary to launch the Whopper, this was merely to see what the effect of a more air tight seal would be. This was a huge step for us as using a push button to control the firing mechanism will be easily translatable to the Wii nun-chuck remote, our ultimate goal to control the firing of the candies.
The following code was used to create the launch using a push button and a relay:
"
int relay = 8;
int button = 2;
void setup(){
pinMode(led,OUTPUT);
pinMode(relay,OUTPUT);
pinMode(button, INPUT_PULLUP);
digitalWrite(relay, LOW);
}
void loop(){
boolean buttonState = digitalRead(button);
if(buttonState == 0){
digitalWrite(relay, HIGH);
delay(100);
digitalWrite(relay, LOW);
}
if(buttonState == 1){
digitalWrite(relay, LOW);
}
}
"
No comments:
Post a Comment