maceemiller wrote: ↑Mon Jan 27, 2020 6:14 pm
Hi all. So while I'm waiting to see what motor I should use I've been getting on with my trap
I've NO skills when it comes to woodwork (I'm a landscaper/bricklayer.....i prefer dirt and cement) yet I'm happy where I'm at in this build....
I am working on this build and another similar to it which can be found at
https://www.thingiverse.com/thing:2377686
I have all the pieces made and/or purchased and am now ready to assemble.
But, I Have hit a snag. The person who posted this build gives the following code for the arduino nano.
Arduino code.
#include<AccelStepper.h>
#define HALFSTEP 8
#define motorPin1 3 // IN1 on the ULN2003 driver 1
#define motorPin2 4 // IN2 on the ULN2003 driver 1
#define motorPin3 5 // IN3 on the ULN2003 driver 1
#define motorPin4 6 // IN4 on the ULN2003 driver 1
AccelStepper stepper1(HALFSTEP, motorPin1, motorPin3, motorPin2, motorPin4);
int buttonmode = 2;
boolean Motortoggle = 0;
const int SwitchPin = 12; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin
// variables will change:
int Switchstate = 0; // variable for reading the pushbutton status
void setup() {
Serial.begin(9600);
stepper1.setMaxSpeed(261.41);
stepper1.setAcceleration(50.0);
stepper1.setSpeed(261.41);
//stepper1.moveTo(20000);
// initialize the LED pin as an output:
pinMode(SwitchPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
digitalWrite(SwitchPin, HIGH);
}
void loop() {
// read the state of the switch value:
Switchstate = digitalRead(SwitchPin);
if (Switchstate == LOW) {
stepper1.runSpeed();
digitalWrite(ledPin, HIGH);
} else {
stepper1.stop();
digitalWrite(ledPin, LOW);
}
}
Unfortunately, I do not know how to load the code onto the nano. I have installed marlin code onto an arduino board before, but can't figure this out at all!!
Hope somebody can help me.