This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
bdev:filamentextrduer_code [2022/11/07 17:25] richard |
bdev:filamentextrduer_code [2022/12/01 03:02] (current) richard |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Filabotextruder code 1 ====== | ====== Filabotextruder code 1 ====== | ||
+ | 5 motor | ||
< | < | ||
#include < | #include < | ||
- | #include <Wire.h> | + | #include <AccelStepper.h> |
- | #include < | + | |
#define motorInterfaceType 1 | #define motorInterfaceType 1 | ||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | #define THERMISTOR_PINA A11 | ||
- | #define TEMPCONTROLA 10 | ||
- | // StaticThreadController that will controll all threads | + | struct flowData{ |
- | // All non-pointers go with '&', | + | int bfl; |
- | // | + | int dir; |
- | // | + | }; |
//Define the aggressive and conservative Tuning Parameters | //Define the aggressive and conservative Tuning Parameters | ||
Line 26: | Line 21: | ||
double Setpoint, Input, Output, OutputA, OutputB, OutputC; | double Setpoint, Input, Output, OutputA, OutputB, OutputC; | ||
int tme = 250; | int tme = 250; | ||
+ | |||
+ | int directionA = 0; | ||
+ | int directionB = 0; | ||
+ | int directionC = 0; | ||
+ | int directionD = 0; | ||
+ | |||
+ | int ton = 0; | ||
+ | |||
+ | int buttonastate = 0; | ||
+ | int buttonbstate = 0; | ||
+ | int buttoncstate = 0; | ||
+ | int buttondstate = 0; | ||
+ | |||
+ | |||
+ | int afl = 0; | ||
+ | int bfl = 0; | ||
+ | int cfl = 0; | ||
+ | int dfl = 0; | ||
+ | |||
+ | String command; | ||
+ | long int currpos; | ||
+ | long int pos; | ||
+ | |||
+ | //Specify the links and initial tuning parameters | ||
+ | PID myPIDA(& | ||
+ | |||
+ | |||
+ | #define THERMISTOR_PINA A0 | ||
+ | #define TEMPCONTROLA 13 | ||
+ | #define PUMP 12 | ||
+ | |||
+ | int PS[] = {26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 45, 47, 49}; | ||
+ | |||
+ | // Define some steppers and the pins the will use | ||
+ | const int enablePinA = PS[0]; | ||
+ | const int directionPinA = PS[1]; | ||
+ | const int stepsPinA = PS[2]; | ||
+ | |||
+ | const int enablePinB = PS[3]; | ||
+ | const int directionPinB = PS[4]; | ||
+ | const int stepsPinB = PS[5]; | ||
+ | |||
+ | const int enablePinC = PS[6]; | ||
+ | const int directionPinC = PS[7]; | ||
+ | const int stepsPinC = PS[8]; | ||
+ | |||
+ | const int enablePinD = PS[9]; | ||
+ | const int directionPinD = PS[10]; | ||
+ | const int stepsPinD = PS[11]; | ||
+ | |||
+ | //const int speedpotA = A1; | ||
+ | //const int gobuttonA = A2; | ||
+ | //const int stopbuttonA = A3; | ||
+ | |||
+ | const int speedpotA = A4; | ||
+ | const int gobuttonA = A5; | ||
+ | const int stopbuttonA = A6; | ||
+ | const int stepspinA = LOW; | ||
+ | |||
+ | const int speedpotB = A7; | ||
+ | const int gobuttonB = A8; | ||
+ | const int stopbuttonB = A9; | ||
+ | const int stepspinB = LOW; | ||
+ | |||
+ | const int speedpotC = A10; | ||
+ | const int gobuttonC = A11; | ||
+ | const int stopbuttonC = A12; | ||
+ | const int stepspinC = LOW; | ||
+ | |||
+ | const int speedpotD = A13; | ||
+ | const int gobuttonD = A14; | ||
+ | const int stopbuttonD = A15; | ||
+ | const int stepspinD = LOW; | ||
+ | |||
+ | AccelStepper stepperA = AccelStepper(motorInterfaceType, | ||
+ | AccelStepper stepperB = AccelStepper(motorInterfaceType, | ||
+ | AccelStepper stepperC = AccelStepper(motorInterfaceType, | ||
+ | AccelStepper stepperD = AccelStepper(motorInterfaceType, | ||
+ | |||
+ | |||
+ | void setup() | ||
+ | { | ||
+ | Serial.begin(115200); | ||
+ | pinMode(stepsPinA, | ||
+ | pinMode(directionPinA, | ||
+ | pinMode(enablePinA, | ||
+ | pinMode(stepsPinB, | ||
+ | pinMode(directionPinB, | ||
+ | pinMode(enablePinB, | ||
+ | pinMode(stepsPinC, | ||
+ | pinMode(directionPinC, | ||
+ | pinMode(enablePinC, | ||
+ | pinMode(stepsPinD, | ||
+ | pinMode(directionPinD, | ||
+ | pinMode(enablePinD, | ||
+ | pinMode(TEMPCONTROLA, | ||
+ | pinMode(PUMP, | ||
+ | digitalWrite(enablePinA, | ||
+ | digitalWrite(enablePinB, | ||
+ | digitalWrite(enablePinC, | ||
+ | digitalWrite(enablePinD, | ||
+ | digitalWrite(directionPinA, | ||
+ | digitalWrite(directionPinB, | ||
+ | digitalWrite(directionPinC, | ||
+ | digitalWrite(directionPinD, | ||
+ | digitalWrite(PUMP, | ||
+ | stepperA.setMaxSpeed(1000*16); | ||
+ | stepperB.setMaxSpeed(1000*16); | ||
+ | stepperC.setMaxSpeed(1000*16); | ||
+ | stepperD.setMaxSpeed(1000*16); | ||
+ | |||
+ | //turn the PID on | ||
+ | myPIDA.SetMode(AUTOMATIC); | ||
+ | } | ||
+ | |||
+ | void loop(){ | ||
+ | |||
+ | int speedA = map(analogRead(speedpotA), | ||
+ | int speedB = map(analogRead(speedpotB), | ||
+ | int speedC = map(analogRead(speedpotC), | ||
+ | int speedD = map(analogRead(speedpotD), | ||
+ | |||
+ | Input = read_temp(" | ||
+ | double gap = abs(Setpoint-Input); | ||
+ | myPIDA.SetTunings(aggKpA, | ||
+ | myPIDA.Compute(); | ||
+ | analogWrite(TEMPCONTROLA, | ||
+ | |||
+ | int rawvalue = analogRead(THERMISTOR_PINA); | ||
+ | int rawvalueA = rawvalue; | ||
+ | float celsiusA = read_temp(" | ||
+ | |||
+ | if (levelstreamon == 1) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | /* | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | */ | ||
+ | |||
+ | flowData A = {bfl, directionA}; | ||
+ | flowData *AA = &A; | ||
+ | flowData AAA = motorStop(stopbuttonA, | ||
+ | directionA = AAA.dir; | ||
+ | motorMove(gobuttonA, | ||
+ | |||
+ | flowData B = {bfl, directionB}; | ||
+ | flowData *BB = &B; | ||
+ | flowData BBB = motorStop(stopbuttonB, | ||
+ | directionB = BBB.dir; | ||
+ | motorMove(gobuttonB, | ||
+ | |||
+ | flowData C = {bfl, directionC}; | ||
+ | flowData *CC = &C; | ||
+ | flowData CCC = motorStop(stopbuttonC, | ||
+ | directionC = CCC.dir; | ||
+ | motorMove(gobuttonC, | ||
+ | |||
+ | flowData D = {bfl, directionD}; | ||
+ | flowData *DD = &D; | ||
+ | flowData DDD = motorStop(stopbuttonD, | ||
+ | directionD = DDD.dir; | ||
+ | motorMove(gobuttonD, | ||
+ | |||
+ | if (A.dir == 1) {stepperA.setSpeed(speedA); | ||
+ | if (B.dir == 1) {stepperB.setSpeed(speedB); | ||
+ | if (C.dir == 1) {stepperC.setSpeed(speedC); | ||
+ | if (D.dir == 1) {stepperD.setSpeed(speedD); | ||
+ | |||
+ | |||
+ | stepperD.runSpeed(); | ||
+ | stepperC.runSpeed(); | ||
+ | stepperB.runSpeed(); | ||
+ | stepperA.runSpeed(); | ||
+ | | ||
+ | | ||
+ | char c = Serial.read(); | ||
+ | if (c== ' | ||
+ | currpos = parseCommand(command, | ||
+ | command = ""; | ||
+ | } | ||
+ | else{ | ||
+ | command +=c; | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | |||
+ | |||
+ | void motorMove(int gobutton, int enablePin){ | ||
+ | if (digitalRead(gobutton) == 1){ | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | |||
+ | flowData motorStop(int stopbutton, int enablePin, int directionPin, | ||
+ | if (digitalRead(stopbutton) ==HIGH){ | ||
+ | digitalWrite(enablePin, | ||
+ | if (X->bfl == 0){ | ||
+ | if (X-> | ||
+ | X->bfl = 1; | ||
+ | } | ||
+ | } else { X->bfl = 0; } | ||
+ | |||
+ | Serial.print(" | ||
+ | Serial.println(stopbutton); | ||
+ | return *X; | ||
+ | } | ||
+ | |||
+ | |||
+ | |||
+ | long int parseCommand(String com, long int currpos){ | ||
+ | // | ||
+ | // | ||
+ | |||
+ | if(com.equalsIgnoreCase(" | ||
+ | | ||
+ | } | ||
+ | else if(com.equalsIgnoreCase(" | ||
+ | digitalWrite(PUMP, | ||
+ | } | ||
+ | else if(com.equalsIgnoreCase(" | ||
+ | digitalWrite(PUMP, | ||
+ | } | ||
+ | else if(com.equalsIgnoreCase(" | ||
+ | Serial.println(" | ||
+ | } | ||
+ | else if (com.substring(0, | ||
+ | settemp = com.substring(8).toDouble(); | ||
+ | Setpoint = settemp; | ||
+ | Serial.print(" | ||
+ | Serial.println(settemp); | ||
+ | } | ||
+ | else if(com.equalsIgnoreCase(" | ||
+ | | ||
+ | } | ||
+ | else if(com.equalsIgnoreCase(" | ||
+ | | ||
+ | } | ||
+ | else if(com.equalsIgnoreCase(" | ||
+ | int rawvalue = analogRead(THERMISTOR_PINA); | ||
+ | float celsius = read_temp(" | ||
+ | | ||
+ | | ||
+ | } | ||
+ | else { | ||
+ | | ||
+ | | ||
+ | } | ||
+ | | ||
+ | } | ||
+ | |||
+ | int readpotentionmetersanity(){ | ||
+ | int val = analogRead(speedpotA); | ||
+ | | ||
+ | | ||
+ | val = analogRead(speedpotB); | ||
+ | | ||
+ | | ||
+ | val = analogRead(speedpotC); | ||
+ | | ||
+ | | ||
+ | val = analogRead(speedpotD); | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | |||
+ | #define NUMTEMPS 20 | ||
+ | short temptable[NUMTEMPS][2] = { | ||
+ | {1, 841}, {54, 255}, | ||
+ | {107, 209}, | ||
+ | {160, 184}, | ||
+ | {213, 166}, | ||
+ | {266, 153}, | ||
+ | {319, 142}, | ||
+ | {372, 132}, | ||
+ | {425, 124}, | ||
+ | {478, 116}, | ||
+ | {531, 108}, | ||
+ | {584, 101}, | ||
+ | {637, 93}, | ||
+ | {690, 86}, | ||
+ | {743, 78}, | ||
+ | {796, 70}, | ||
+ | {849, 61}, | ||
+ | {902, 50}, | ||
+ | {955, 34}, | ||
+ | | ||
+ | }; | ||
+ | |||
+ | float read_temp(String sensor_type) | ||
+ | { | ||
+ | int THERMISTOR_PIN = 0; | ||
+ | if (sensor_type == " | ||
+ | THERMISTOR_PIN = THERMISTOR_PINA; | ||
+ | } | ||
+ | int rawtemp = analogRead(THERMISTOR_PIN); | ||
+ | float current_celsius = 0; | ||
+ | |||
+ | byte i; | ||
+ | for (i=1; i< | ||
+ | { | ||
+ | if (temptable[i][0] > rawtemp) | ||
+ | { | ||
+ | float realtemp | ||
+ | |||
+ | if (realtemp > 255) | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | } | ||
+ | |||
+ | // Overflow: We just clamp to 0 degrees celsius | ||
+ | if (i == NUMTEMPS) | ||
+ | | ||
+ | |||
+ | | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | |||
+ | #include < | ||
+ | #include < | ||
+ | #define motorInterfaceType 1 | ||
+ | |||
+ | |||
+ | //Define the aggressive and conservative Tuning Parameters | ||
+ | double aggKpA=150, aggKiA=0.5, aggKdA=0; | ||
+ | int thermoelectricval = 255; | ||
+ | int celsius; | ||
+ | int levelstreamon; | ||
+ | double settemp = 0; | ||
+ | double Setpoint, Input, Output, OutputA, OutputB, OutputC; | ||
+ | int tme = 250; | ||
+ | |||
+ | int directionA = 0; | ||
+ | int directionB = 0; | ||
+ | int directionC = 0; | ||
+ | |||
+ | int ton = 0; | ||
+ | |||
+ | int buttonastate = 0; | ||
+ | int buttonbstate = 0; | ||
+ | int buttoncstate = 0; | ||
+ | int afl = 0; | ||
+ | int bfl = 0; | ||
+ | int cfl = 0; | ||
+ | |||
+ | String command; | ||
+ | long int currpos; | ||
+ | long int pos; | ||
+ | int goA, goB, goC; | ||
//Specify the links and initial tuning parameters | //Specify the links and initial tuning parameters | ||
Line 31: | Line 411: | ||
+ | #define THERMISTOR_PINA A11 | ||
+ | #define TEMPCONTROLA 10 | ||
+ | |||
+ | // Define some steppers and the pins the will use | ||
const int stepsPinA = 11; | const int stepsPinA = 11; | ||
const int directionPinA = 12; | const int directionPinA = 12; | ||
Line 42: | Line 426: | ||
const int directionPinC = 8; | const int directionPinC = 8; | ||
const int enablePinC = 9; | const int enablePinC = 9; | ||
+ | |||
const int gobuttonA = A0; | const int gobuttonA = A0; | ||
const int stopbuttonA = A1; | const int stopbuttonA = A1; | ||
const int speedpotA = A2; | const int speedpotA = A2; | ||
+ | const int stepspinA = LOW; | ||
const int gobuttonB = A5; | const int gobuttonB = A5; | ||
const int stopbuttonB = A6; | const int stopbuttonB = A6; | ||
const int speedpotB = A3; | const int speedpotB = A3; | ||
+ | const int stepspinB = LOW; | ||
const int gobuttonC = A7; | const int gobuttonC = A7; | ||
- | const int stopbuttonC = A10; | + | const int stopbuttonC = A8; |
const int speedpotC = A4; | const int speedpotC = A4; | ||
+ | const int stepspinC = LOW; | ||
- | int directionA = 0; | ||
- | int directionB = 0; | ||
- | int directionC = 0; | ||
- | |||
- | int ton = 0; | ||
- | |||
- | int buttonastate = 0; | ||
- | int buttonbstate = 0; | ||
- | int buttoncstate = 0; | ||
- | int afl = 0; | ||
- | int bfl = 0; | ||
- | |||
- | String command; | ||
- | long int currpos; | ||
- | long int pos; | ||
- | |||
- | //My Thread (as a pointer) | ||
- | Thread* myThread = new Thread(); | ||
- | //His Thread (not pointer) | ||
- | //Thread hisThread = Thread(); | ||
- | //Thread allThread = Thread(); | ||
- | Thread runnerAThread = Thread(); | ||
- | Thread runnerBThread = Thread(); | ||
- | Thread runnerCThread = Thread(); | ||
+ | AccelStepper stepperA = AccelStepper(motorInterfaceType, | ||
+ | AccelStepper stepperB = AccelStepper(motorInterfaceType, | ||
+ | AccelStepper stepperC = AccelStepper(motorInterfaceType, | ||
- | void setup() | + | void setup() |
- | | + | { |
Serial.begin(115200); | Serial.begin(115200); | ||
pinMode(stepsPinA, | pinMode(stepsPinA, | ||
Line 90: | Line 457: | ||
pinMode(directionPinB, | pinMode(directionPinB, | ||
pinMode(enablePinB, | pinMode(enablePinB, | ||
- | pinMode(speedpotA, INPUT); | + | pinMode(stepsPinC, OUTPUT); |
- | pinMode(gobuttonA, INPUT); | + | pinMode(directionPinC, OUTPUT); |
- | pinMode(stopbuttonA, INPUT); | + | pinMode(enablePinC, OUTPUT); |
- | pinMode(speedpotB, INPUT); | + | pinMode(TEMPCONTROLA, OUTPUT); |
- | pinMode(gobuttonB, | + | |
- | pinMode(stopbuttonB, | + | |
- | pinMode(speedpotC, | + | |
- | pinMode(gobuttonC, | + | |
- | pinMode(stopbuttonC, | + | |
- | | + | |
- | allThread.onRun(runnerA); | + | |
- | allThread.onRun(runnerB); | + | |
- | allThread.onRun(runnerC); | + | |
- | */ | + | |
- | runnerAThread.onRun(runnerA); | + | |
- | | + | |
- | | + | |
- | // | ||
- | |||
- | digitalWrite(enablePinA, | ||
- | digitalWrite(enablePinB, | ||
digitalWrite(directionPinA, | digitalWrite(directionPinA, | ||
digitalWrite(directionPinB, | digitalWrite(directionPinB, | ||
digitalWrite(directionPinC, | digitalWrite(directionPinC, | ||
- | | + | |
+ | stepperA.setMaxSpeed(1000*16); | ||
+ | stepperB.setMaxSpeed(1000*16); | ||
+ | stepperC.setMaxSpeed(1000*16); | ||
+ | |||
+ | // | ||
+ | myPIDA.SetMode(AUTOMATIC); | ||
} | } | ||
- | void loop() { | + | void loop(){ |
+ | |||
+ | int speedA = map(analogRead(speedpotA), | ||
+ | int speedB = map(analogRead(speedpotB), | ||
+ | int speedC = map(analogRead(speedpotC), | ||
Input = read_temp(" | Input = read_temp(" | ||
Line 125: | Line 489: | ||
myPIDA.SetTunings(aggKpA, | myPIDA.SetTunings(aggKpA, | ||
myPIDA.Compute(); | myPIDA.Compute(); | ||
+ | Serial.print(" | ||
+ | Serial.println(OutputA); | ||
analogWrite(TEMPCONTROLA, | analogWrite(TEMPCONTROLA, | ||
Line 130: | Line 496: | ||
int rawvalueA = rawvalue; | int rawvalueA = rawvalue; | ||
float celsiusA = read_temp(" | float celsiusA = read_temp(" | ||
- | |||
- | Serial.print("" | ||
- | |||
- | / | ||
- | digitalWrite(stepsPinA, | ||
- | digitalWrite(directionPinA, | ||
- | digitalWrite(enablePinA, | ||
- | |||
- | digitalWrite(stepsPinB, | ||
- | digitalWrite(directionPinB, | ||
- | digitalWrite(enablePinB, | ||
- | |||
- | digitalWrite(stepsPinC, | ||
- | digitalWrite(directionPinC, | ||
- | digitalWrite(enablePinC, | ||
- | */ | ||
if (levelstreamon == 1) { | if (levelstreamon == 1) { | ||
Line 158: | Line 508: | ||
if (digitalRead(stopbuttonA) ==HIGH){ | if (digitalRead(stopbuttonA) ==HIGH){ | ||
+ | digitalWrite(enablePinA, | ||
+ | goA = 0; | ||
if (bfl == 0){ | if (bfl == 0){ | ||
if (directionA==0){directionA = 1; digitalWrite(directionPinA, | if (directionA==0){directionA = 1; digitalWrite(directionPinA, | ||
Line 167: | Line 519: | ||
if (digitalRead(gobuttonA) == 1){ | if (digitalRead(gobuttonA) == 1){ | ||
+ | | ||
| | ||
- | // | + | goA = 1; |
- | | + | |
} | } | ||
if (digitalRead(stopbuttonB) ==HIGH){ | if (digitalRead(stopbuttonB) ==HIGH){ | ||
+ | digitalWrite(enablePinB, | ||
+ | goA = 0; | ||
if (bfl == 0){ | if (bfl == 0){ | ||
if (directionB==0){directionB = 1; digitalWrite(directionPinB, | if (directionB==0){directionB = 1; digitalWrite(directionPinB, | ||
Line 182: | Line 536: | ||
if (digitalRead(gobuttonB) == 1){ | if (digitalRead(gobuttonB) == 1){ | ||
- | Serial.println(" | + | |
- | // | + | Serial.println(" |
- | | + | goA = 1; |
} | } | ||
- | if (digitalRead(stopbuttonC) ==HIGH){ | + | if (digitalRead(stopbuttonC) ==HIGH){ |
- | if (bfl == 0){ | + | goC = 0; |
+ | digitalWrite(enablePinC, | ||
+ | if (cfl == 0){ | ||
if (directionC==0){directionC = 1; digitalWrite(directionPinC, | if (directionC==0){directionC = 1; digitalWrite(directionPinC, | ||
Serial.print(directionC); | Serial.print(directionC); | ||
Serial.println(" | Serial.println(" | ||
- | | + | |
} | } | ||
- | } else { bfl = 0; } | + | } else { cfl = 0; } |
if (digitalRead(gobuttonC) == 1){ | if (digitalRead(gobuttonC) == 1){ | ||
+ | digitalWrite(enablePinC, | ||
Serial.println(" | Serial.println(" | ||
- | // | + | |
- | | + | |
} | } | ||
+ | |||
+ | if (directionA == 1) {stepperA.setSpeed(speedA); | ||
+ | if (directionB == 1) {stepperB.setSpeed(speedB); | ||
+ | if (directionC == 1) {stepperC.setSpeed(speedC); | ||
| | ||
- | | + | //if (stepperC.distanceToGo() == 0) |
- | { | + | // |
+ | stepperC.runSpeed(); | ||
+ | stepperB.runSpeed(); | ||
+ | stepperA.runSpeed(); | ||
+ | |||
+ | if(Serial.available()){ | ||
char c = Serial.read(); | char c = Serial.read(); | ||
- | if (c== ' | + | if (c== ' |
- | | + | |
currpos = parseCommand(command, | currpos = parseCommand(command, | ||
command = ""; | command = ""; | ||
} | } | ||
- | | + | else{ |
- | | + | |
- | | + | |
command +=c; | command +=c; | ||
} | } | ||
- | } | + | |
- | | + | |
} | } | ||
- | long int parseCommand(String com, long int currpos) | + | long int parseCommand(String com, long int currpos){ |
- | { | + | |
// | // | ||
// | // | ||
Line 268: | Line 628: | ||
} | } | ||
- | |||
- | int runnerA(){ | ||
- | int stpper = 1; | ||
- | int speed = analogRead(speedpotA); | ||
- | int stepdelay = map(speed, 0, 1023, 1, 2000); | ||
- | | ||
- | speed = analogRead(speedpotA); | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | if (digitalRead(stopbuttonA) ==HIGH){ break; } | ||
- | } | ||
- | return 0; | ||
- | } | ||
- | |||
- | int runnerB(){ | ||
- | int stpper = 1; | ||
- | int speed = analogRead(speedpotB); | ||
- | int stepdelay = map(speed, 0, 1023, 1, 2000); | ||
- | | ||
- | speed = analogRead(speedpotB); | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | if (digitalRead(stopbuttonB) ==HIGH){ break; } | ||
- | } | ||
- | return 0; | ||
- | } | ||
- | |||
- | int runnerC(){ | ||
- | int stpper = 1; | ||
- | int speed = analogRead(speedpotB); | ||
- | int stepdelay = map(speed, 0, 1023, 1, 2000); | ||
- | | ||
- | speed = analogRead(speedpotC); | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | | ||
- | if (digitalRead(stopbuttonC) ==HIGH){ break; } | ||
- | } | ||
- | return 0; | ||
- | } | ||
#define NUMTEMPS 20 | #define NUMTEMPS 20 | ||
Line 369: | Line 681: | ||
| | ||
} | } | ||
- | |||
</ | </ | ||