File talk:CEB-ControllerCode-v1708.abp

From Open Source Ecology
Jump to: navigation, search

ardublock compatibilities

  • previous code uses Switch Case
    • ardublock doesnt feature this as a block. will have to use if statements

To Do

  • define pins high/low
    • input for sensors
    • output to relays for solenoids
  • cylinder timing and control

Overview

define goal pressure //when to stop pressing

setup

if button is pressed (or jumper installed) on restart, clear eeprom to 0

if eeprom > 0, define variables from eeprom

//set desired brick height
fully retract main cylinder
delay 30 seconds to allow for manual main cylinder positioining
start timer
retract main cyliner till pressure spike
stop timer
define inches from full retraction to desired position
extend back to set position

if eeprom = 0, run calibration routine

define brick Width
define drawer cylinder stroke length
fully retract drawer till pressure spike
start timer
fully extend drawer till pressure spike
stop timer
calculate time per inch
calculate time per brickW

save to eeprom

retract one brickW to compression area
fully retract main cyliner till pressure spike
start timer
extend main cyliner till pressure spike against drawer
stop timer
define time to eject position

save to eeprom

//set desired brick height
fully retract main cylinder
delay 30 seconds to allow for manual main cylinder positioining
start timer
retract main cyliner till pressure spike
stop timer
define inches from full retraction to desired position
extend back to set position

loop

fully extend drawer - to load poistion. stop.

delay - for soil to fall

retract drawer to compression position. stop.

extend main cylinder till goal pressure reached

retract 1/2 inch. stop.

retract drawer to ejection position. stop.

extend main cylinder to ejection position. stop.

//block dirt to allow main cylinder to retact without dirt. when draw moves, dirt will all fall at once.
extend drawer to compression position. stop. 

retract main cyliner to set position. stop.