Work in progress: Serial does not work from external library

This commit is contained in:
Matt McWilliams 2023-03-20 19:45:32 -04:00
parent 77a0f7d8a0
commit 5c6b9191e5
7 changed files with 38 additions and 49 deletions

View File

@ -2,14 +2,14 @@
#include "McopySerial.h"
McopySerial::McopySerial (char identity) {
McopySerial::McopySerial ( char identity) {
id = identity;
}
void McopySerial::begin () {
Serial.begin(baud);
Serial.flush();
Serial.setTimeout(serialDelay);
Serial.setTimeout(serialDelay);
}
char McopySerial::loop () {

View File

@ -2,14 +2,14 @@
#include "McopySerial.h"
McopySerial::McopySerial (char identity) {
McopySerial::McopySerial ( char identity) {
id = identity;
}
void McopySerial::begin () {
Serial.begin(baud);
Serial.flush();
Serial.setTimeout(serialDelay);
Serial.setTimeout(serialDelay);
}
char McopySerial::loop () {

View File

@ -2,14 +2,14 @@
#include "McopySerial.h"
McopySerial::McopySerial (char identity) {
McopySerial::McopySerial ( char identity) {
id = identity;
}
void McopySerial::begin () {
Serial.begin(baud);
Serial.flush();
Serial.setTimeout(serialDelay);
Serial.setTimeout(serialDelay);
}
char McopySerial::loop () {

View File

@ -65,6 +65,8 @@ McopySerial mc(McopySerial::PROJECTOR_IDENTIFIER);
void setup () {
mc.begin();
pins();
proj_dir = false;
cmdChar = 'p';
}
void loop () {
@ -73,7 +75,7 @@ void loop () {
if (proj_running) {
proj_microswitch();
} else {
cmdChar = mc.loop();
//cmdChar = mc.loop();
cmd(cmdChar);
}
}
@ -83,8 +85,8 @@ void pins () {
pinMode(PROJECTOR_FWD, OUTPUT);
pinMode(PROJECTOR_BWD, OUTPUT);
digitalWrite(PROJECTOR_FWD, LOW);
digitalWrite(PROJECTOR_BWD, LOW);
digitalWrite(PROJECTOR_FWD, HIGH);
digitalWrite(PROJECTOR_BWD, HIGH);
}
void cmd (char val) {
@ -103,9 +105,9 @@ void proj_start () {
proj_time = millis();
if (proj_dir) {
digitalWrite(PROJECTOR_FWD, HIGH);
digitalWrite(PROJECTOR_FWD, LOW);
} else {
digitalWrite(PROJECTOR_BWD, HIGH);
digitalWrite(PROJECTOR_BWD, LOW);
}
proj_running = true;
@ -114,8 +116,8 @@ void proj_start () {
void proj_stop () {
//stop both directions
delay(10);
digitalWrite(PROJECTOR_FWD, LOW);
digitalWrite(PROJECTOR_BWD, LOW);
digitalWrite(PROJECTOR_FWD, HIGH);
digitalWrite(PROJECTOR_BWD, HIGH);
mc.confirm(McopySerial::PROJECTOR);
mc.log("projector()");

View File

@ -2,14 +2,14 @@
#include "McopySerial.h"
McopySerial::McopySerial (char identity) {
McopySerial::McopySerial ( char identity) {
id = identity;
}
void McopySerial::begin () {
Serial.begin(baud);
Serial.flush();
Serial.setTimeout(serialDelay);
Serial.setTimeout(serialDelay);
}
char McopySerial::loop () {

View File

@ -1,34 +0,0 @@
/*
JK modules
Directional switch connector =
Philmore
Mobile Connector
Panel Mount 3 Pin Male/Female
No. 61-623
.625" Diameter
*/
module jk_male_connector_mount () {
$fn = 200;
D = 17;
OD = 28;
H = 25;
difference () {
union () {
cylinder(r = OD / 2, h = H, center = true);
//cube([12, 48, 3], center = true);
}
//main void
translate([0, 0, -3]) cylinder(r = (OD / 2) - 3, h = H, center = true);
//connector void
cylinder(r = D / 2, h = H * 2, center = true);
}
}
rotate([180, 0, 0]) jk_male_connector_mount();

21
scad/mcopy_projector.scad Normal file
View File

@ -0,0 +1,21 @@
include <./common/common.scad>;
PART = "debug";
module debug () {
cube();
}
module projector () {
}
module key () {
}
if (PART == "projector") {
} else {
debug();
}