All capper work. Debug firmware for testing. STL of cap as printed.
This commit is contained in:
parent
f9d716552b
commit
2f9201716a
|
@ -1,6 +1,6 @@
|
||||||
#include <Servo.h>
|
#include <Servo.h>
|
||||||
|
|
||||||
boolean debug_state = false;
|
boolean debug_state = true;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
@ -30,9 +30,10 @@ volatile boolean cap_state = false;
|
||||||
volatile boolean endstop_state = false;
|
volatile boolean endstop_state = false;
|
||||||
|
|
||||||
volatile int angle = 0;
|
volatile int angle = 0;
|
||||||
const int cap_on_angle = 0;
|
const int cap_on_angle = 153;
|
||||||
const int cap_off_angle = 60;
|
const int cap_off_angle = 93;
|
||||||
volatile long timer = 0;
|
volatile long timer = 0;
|
||||||
|
volatile int current_angle = 0;
|
||||||
|
|
||||||
const char cmd_cap_on = 'A';
|
const char cmd_cap_on = 'A';
|
||||||
const char cmd_cap_off = 'B';
|
const char cmd_cap_off = 'B';
|
||||||
|
@ -48,7 +49,7 @@ const int serialDelay = 5;
|
||||||
Servo servo;
|
Servo servo;
|
||||||
//SG-5010 speed 0.18s / 60 degree
|
//SG-5010 speed 0.18s / 60 degree
|
||||||
//converted to milliseconds/angle
|
//converted to milliseconds/angle
|
||||||
const float servoSpeed = 180.0 / 60.0;
|
const float servoSpeed = 200.0 / 60.0;
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(57600);
|
Serial.begin(57600);
|
||||||
|
@ -108,14 +109,10 @@ void Pins_init () {
|
||||||
|
|
||||||
void Servo_init () {
|
void Servo_init () {
|
||||||
servo.attach(PIN_SERVO);
|
servo.attach(PIN_SERVO);
|
||||||
delay(100);
|
|
||||||
servo.write(180);
|
|
||||||
delay(500);
|
|
||||||
servo.write(0);
|
|
||||||
delay(500);
|
|
||||||
if (!Read_endstop()) {
|
|
||||||
Cap_off(true);
|
Cap_off(true);
|
||||||
}
|
/*if (!Read_endstop()) {
|
||||||
|
Cap_off(true);
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean Read_endstop () {
|
boolean Read_endstop () {
|
||||||
|
@ -124,7 +121,7 @@ boolean Read_endstop () {
|
||||||
|
|
||||||
void Servo_angle (int newAngle) {
|
void Servo_angle (int newAngle) {
|
||||||
servo.write(newAngle);
|
servo.write(newAngle);
|
||||||
delay(Servo_delay(newAngle, angle));
|
delay(Servo_delay(newAngle, angle) + 50);
|
||||||
angle = newAngle;
|
angle = newAngle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +131,8 @@ int Servo_delay (int angleA, int angleB) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cap_off (boolean suppress) {
|
void Cap_off (boolean suppress) {
|
||||||
if (cap_state) {
|
current_angle = servo.read();
|
||||||
|
if (cap_state || current_angle != cap_off_angle) {
|
||||||
Servo_angle(cap_off_angle);
|
Servo_angle(cap_off_angle);
|
||||||
cap_state = false;
|
cap_state = false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -147,7 +145,8 @@ void Cap_off (boolean suppress) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cap_on (boolean suppress) {
|
void Cap_on (boolean suppress) {
|
||||||
if (!cap_state) {
|
current_angle = servo.read();
|
||||||
|
if (!cap_state || current_angle != cap_on_angle) {
|
||||||
Servo_angle(cap_on_angle);
|
Servo_angle(cap_on_angle);
|
||||||
cap_state = true;
|
cap_state = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -11,8 +11,12 @@ LensY = 20;
|
||||||
|
|
||||||
CapOffsetX = -50;
|
CapOffsetX = -50;
|
||||||
CapOffsetY = -11;
|
CapOffsetY = -11;
|
||||||
|
CapLengthX = 50;
|
||||||
|
CapWidthZ = 4;
|
||||||
|
|
||||||
|
BoltSpacingX = 10;
|
||||||
BoltSpacingY = 49;
|
BoltSpacingY = 49;
|
||||||
|
BoltD = 5;
|
||||||
|
|
||||||
module Mount () {
|
module Mount () {
|
||||||
$fn = 200;
|
$fn = 200;
|
||||||
|
@ -27,11 +31,14 @@ module Mount () {
|
||||||
cylinder(r=R(LensVoidDiameter), h=LensY+1, center=true);
|
cylinder(r=R(LensVoidDiameter), h=LensY+1, center=true);
|
||||||
}
|
}
|
||||||
difference () {
|
difference () {
|
||||||
translate([50, 0, -6]) cube([100, LensVoidDiameter + 30, 8], center = true);
|
translate([50, 0, -6]) cube([100, LensVoidDiameter + 30, 8], center=true);
|
||||||
cylinder(r=R(LensVoidDiameter), h=LensY+1, center=true);
|
cylinder(r=R(LensVoidDiameter), h=LensY+1, center=true);
|
||||||
translate([50, 0, -6]) {
|
translate([50, 0, -6]) {
|
||||||
cube([20, 40.25, 10], center = true);
|
cube([20, 40.25, 10], center = true);
|
||||||
translate([0, BoltSpacingY/2, 0])
|
translate([BoltSpacingX/2, BoltSpacingY/2, 0])cylinder(r=R(BoltD), h=20, center=true);
|
||||||
|
translate([-BoltSpacingX/2, BoltSpacingY/2, 0])cylinder(r=R(BoltD), h=20, center=true);
|
||||||
|
translate([BoltSpacingX/2, -BoltSpacingY/2, 0])cylinder(r=R(BoltD), h=20, center=true);
|
||||||
|
translate([-BoltSpacingX/2, -BoltSpacingY/2, 0])cylinder(r=R(BoltD), h=20, center=true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,13 +53,34 @@ module Cap () {
|
||||||
union(){
|
union(){
|
||||||
translate([CapOffsetX,CapOffsetY,0]){
|
translate([CapOffsetX,CapOffsetY,0]){
|
||||||
cylinder(r=R(LensVoidDiameter) + 4, h=4, center = true);
|
cylinder(r=R(LensVoidDiameter) + 4, h=4, center = true);
|
||||||
translate([35,(LensVoidDiameter/4)+1,0]) cube([50,R(LensVoidDiameter),4], center=true);
|
translate([35,(LensVoidDiameter/4)+1,0]) {
|
||||||
|
difference () {
|
||||||
|
cube([CapLengthX,R(LensVoidDiameter),CapWidthZ], center=true);
|
||||||
|
translate([R(CapLengthX)-(R(LensVoidDiameter)/2), 0, 0]) difference() {
|
||||||
|
cube([R(LensVoidDiameter),R(LensVoidDiameter), CapWidthZ+1], center=true);
|
||||||
|
cylinder(r=R(LensVoidDiameter)/2, h=CapWidthZ+1+1, center=true);
|
||||||
|
translate([-R(LensVoidDiameter)/2, 0, 0]) cube([R(LensVoidDiameter),R(LensVoidDiameter), CapWidthZ+1], center=true);
|
||||||
}
|
}
|
||||||
cylinder(r=5,h=10,center=true);
|
|
||||||
}
|
}
|
||||||
cylinder(r=2,h=10+1,center=true);
|
}
|
||||||
|
}
|
||||||
|
translate([0, 0, -4]) cylinder(r=5,h=4,center=true);
|
||||||
|
}
|
||||||
|
translate([0, 0, -4]) cylinder(r1=R(5.5), r2=R(5.4),h=4.01,center=true);
|
||||||
|
cylinder(r=R(5.4),h=10,center=true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
module Debug () {
|
||||||
|
Mount();
|
||||||
|
translate([-CapOffsetX,-CapOffsetY,0]) rotate([0,0,-60]) Cap();
|
||||||
|
}
|
||||||
|
|
||||||
Mount();
|
Render="Debug";
|
||||||
translate([-CapOffsetX,-CapOffsetY,0]) rotate([0,0,-60]) Cap();
|
|
||||||
|
if (Render=="Debug") {
|
||||||
|
Debug();
|
||||||
|
} else if (Render=="Cap") {
|
||||||
|
Cap();
|
||||||
|
} else if (Render=="Mount") {
|
||||||
|
Mount();
|
||||||
|
}
|
Binary file not shown.
Loading…
Reference in New Issue