Presstest v1.0

From Open Source Ecology
Jump to: navigation, search

Note: view this code in Edit mode in Mediawiki to see the correct formatting.

//This code is in the public domain. By Marcin Jakubowski on Nov. 5, 2009 //Control code for running The Liberator high performance CEB press; this code yields 6 bricks per minute //with a 5 inch main cylinder and a 2.5 inch secondary cylinder.

int mainup = 5; // Sets pinout on the Arduino - pins 5,6,10, and 11 are used. int maindown = 6; int secin = 10; int secout = 11; unsigned long time = 800; float factor1 = 3.0; // Main cylinder moves down 7 inches to load soil. float factor2 = 0.9; // Sec. cylinder moves to pressing position, or 7 inches out. float factor3 = 2.0; // Main moves up 4 inches to compress the brick. float factor4 = 0.1; // Main moves down 1/4" to release pressure. float factor5 = 1.0; // Sec. opens drawer, or 7 inches out. float factor6 = 2.0; // Main ejects brick from compression chamber, 4.5 inches up.

                      // Extra half inch accoounts for extra thick bricks.

float factor7 = 2; // Sec. cylinder moves 14 inches in to eject block from machine.

                      // Cycle of 7 steps repeats.

void setup() { pinMode(mainup, OUTPUT); pinMode(maindown, OUTPUT); pinMode(secin, OUTPUT); pinMode(secout, OUTPUT); // To initialize cylinders: // 1. Release drawer (if pressured).

 digitalWrite(maindown, HIGH);   
 delay(time*.2);                 
 digitalWrite(maindown, LOW);   

// 2. Move drawer all the way out.

 digitalWrite(secout, HIGH);   
 delay(time*1.31);                 
 digitalWrite(secout, LOW);   

// 3. Eject any block from compression chamber.

 digitalWrite(mainup, HIGH);   
 delay(time*4);                 
 digitalWrite(mainup, LOW);   

// 4. Eject any block from machine

 digitalWrite(secin, HIGH);   
 delay(time*1.75);                 
 digitalWrite(secin, LOW);   

}

void loop() { // Main cylinder moves down 8 inches to load soil. digitalWrite(maindown, HIGH); delay(time*factor1); digitalWrite(maindown, LOW);

// Sec. cylinder moves to pressing position, or 7 inches out. digitalWrite(secout, HIGH); delay(time*factor2); digitalWrite(secout, LOW);

// Main moves up 4 inches to compress the brick. digitalWrite(mainup, HIGH); delay(time*factor3); digitalWrite(mainup, LOW);

// Main moves down 1/4" to release pressure. digitalWrite(maindown, HIGH); delay(time*factor4); digitalWrite(maindown, LOW);

// Sec. opens drawer, or 7 inches out. digitalWrite(secout, HIGH); delay(time*factor5); digitalWrite(secout, LOW);

// Main ejects brick from compression chamber, 4.5 inches up. digitalWrite(mainup, HIGH); delay(time*factor6); digitalWrite(mainup, LOW);

// Sec. cylinder moves 14 inches in to eject block from machine. digitalWrite(secin, HIGH); delay(time*factor7); digitalWrite(secin, LOW); }