mirror of
https://github.com/usatiuk/EggbotWireless.git
synced 2025-10-27 01:07:49 +01:00
change crystal to 16MHz
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
#include "Pen.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <Servo.h>
|
||||
|
||||
#include "Pen.h"
|
||||
|
||||
Pen::Pen(int pin, int posEngaged, int posDisengaged)
|
||||
: posEngaged(posEngaged), posDisengaged(posDisengaged), pin(pin) {}
|
||||
|
||||
void Pen::engage() {
|
||||
if (!engaged) {
|
||||
for(int i = posDisengaged; i > posEngaged; i--) {
|
||||
for (int i = posDisengaged; i > posEngaged; i--) {
|
||||
servo.write(i);
|
||||
delay(5);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Stepper.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <util/atomic.h>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <Wire.h>
|
||||
#include <avr/wdt.h>
|
||||
#include <util/atomic.h>
|
||||
|
||||
#include "Config.h"
|
||||
#include "Globals.h"
|
||||
#include "common/Commands.h"
|
||||
@@ -12,9 +13,10 @@ int curRPM = defRPM;
|
||||
bool needAdjust;
|
||||
|
||||
int calculateDelay(float rpm, int stepsPerRevolution) {
|
||||
//Delay between steps in a timer routine
|
||||
// Delay between steps in a timer routine
|
||||
// Delay = (ticks/sec)/(rpm/60 * steps/rev)
|
||||
return ((float)ticksPerSecond * (float)60) / (rpm * (float)stepsPerRevolution);
|
||||
return ((float)ticksPerSecond * (float)60) /
|
||||
(rpm * (float)stepsPerRevolution);
|
||||
}
|
||||
|
||||
void adjustRPM() {
|
||||
@@ -118,7 +120,7 @@ void execCommand(Command cmd) {
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
servoStepper.setPos(xLimit);
|
||||
servoStepper.setPos(xLimit);
|
||||
pen.init();
|
||||
Wire.begin(8);
|
||||
Wire.onReceive(receiveEvent);
|
||||
|
||||
Reference in New Issue
Block a user