GMU:Sustainable Aesthetics/Passion Asasu: Difference between revisions

From Medien Wiki
No edit summary
No edit summary
Line 21: Line 21:


'''Code'''
'''Code'''
'''''arduino code :'''''


  int pump_in =
3; // connect pump through mosfet on arduino pin 3 == PWM (fake anolog pin)
int pump_out =
5; // connect pump through mosfet on arduino pin 5 == PWM (fake anolog pin)
void
setup() {
// put your setup code here, to run once:
pinMode(pump_in, OUTPUT); // declare pin as output pin
pinMode(pump_out, OUTPUT); // declare pin as output pin
Serial.begin(9800);
}
void
loop() {
// put your main code here, to run repeatedly:
analogWrite(pump_out,
0); // turn off the pump
// make a for loop in order top blow up the balloon while ramping the motor
for (int i =
60; i <
255; i++) {
analogWrite(pump_in, i); // turn on the pump_in pin with value "i"
delay(50); // wait for 50 milliseconds
//Serial.println(i); // print the value of i
}
analogWrite(pump_in,
0); // turn off the pump
// delay: wait for some time
delay(1000); // wait for one second
// enter an eternal loop for prototyping
// here will be a for loop for sucking out the air again
// while (1) {}
analogWrite(pump_in,
0); // turn off the pump
// make a for loop in order top blow up the balloon while ramping the motor
for (int i =
255; i >
60; i--) {
analogWrite(pump_out, i); // turn on the pump_in pin with value "i"
delay(50); // wait for 50 milliseconds
//Serial.println(i); // print the value of i
}
analogWrite(pump_out,
0); // turn off the pump
// delay: wait for some time
delay(1000); // wait for one second
}
'''Materials'''
'''Materials'''