mirror of
https://github.com/usatiuk/EggbotWireless.git
synced 2025-10-26 08:47:49 +01:00
change crystal to 16MHz
This commit is contained in:
@@ -16,19 +16,19 @@ framework = arduino
|
||||
; PlatformIO requires the board parameter. Must match your actual hardware
|
||||
board = ATmega328P
|
||||
; Clock frequency in [Hz]
|
||||
board_build.f_cpu = 12000000L
|
||||
board_build.f_cpu = 16000000L
|
||||
board_hardware.oscillator = external
|
||||
; Hardware UART for serial upload
|
||||
board_hardware.uart = no_bootloader
|
||||
; Brown-out detection
|
||||
board_hardware.bod = 1.8v
|
||||
board_hardware.bod = 2.7v
|
||||
|
||||
board_upload.speed = 115200
|
||||
|
||||
monitor_speed = 9600
|
||||
|
||||
upload_protocol = stk500
|
||||
upload_port = COM3
|
||||
upload_flags =
|
||||
-PCOM8
|
||||
|
||||
lib_deps = 883 #Servo
|
||||
@@ -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