fit code to the new board

This commit is contained in:
2019-07-10 14:02:49 +03:00
parent d6e881bb39
commit 46bd7c4b29
5 changed files with 14 additions and 14 deletions

View File

@@ -14,5 +14,6 @@ board = esp12e
framework = arduino framework = arduino
monitor_speed = 115200 monitor_speed = 115200
board_build.f_cpu = 80000000L board_build.f_cpu = 80000000L
upload_resetmethod = nodemcu
upload_port=/dev/ttyUSB0 upload_port=/dev/ttyUSB0

View File

@@ -58,6 +58,8 @@ void sendCommand(float *command) {
void setup() { void setup() {
Serial.begin(115200); Serial.begin(115200);
Wire.begin(12, 13); Wire.begin(12, 13);
pinMode(5, OUTPUT);
digitalWrite(5, true);
} }
void loop() { void loop() {

View File

@@ -15,11 +15,11 @@
#define STEPS_PER_REVOLUTION (360/1.8) * 32 #define STEPS_PER_REVOLUTION (360/1.8) * 32
#define DEF_RPM 2 #define DEF_RPM 2
Stepper eggStepper(24, 25, STEPS_PER_REVOLUTION, 0, Y_DEGREES_PER_MM); Stepper eggStepper(6, 5, STEPS_PER_REVOLUTION, 0, Y_DEGREES_PER_MM);
Stepper servoStepper(28, 29, -STEPS_PER_REVOLUTION, X_LIMIT, Stepper servoStepper(4, 3, -STEPS_PER_REVOLUTION, X_LIMIT,
X_DEGREES_PER_MM); X_DEGREES_PER_MM);
Pen pen(23, 120, 180); Pen pen(7, 120, 180);
unsigned int eggStepperDelay; unsigned int eggStepperDelay;
unsigned int servoStepperDelay; unsigned int servoStepperDelay;

View File

@@ -10,17 +10,14 @@
[env:motorcontrol] [env:motorcontrol]
platform = atmelavr platform = atmelavr
board = uno
framework = arduino framework = arduino
board = mightycore32
board_build.mcu = atmega32
board_build.f_cpu = 16000000L
build_flags = build_flags =
board_upload.speed = 115200 board_upload.speed = 115200
monitor_speed = 9600 monitor_speed = 115200
upload_protocol = stk500 upload_protocol = stk500
upload_flags = upload_flags =

View File

@@ -112,24 +112,24 @@ void execCommand() {
} }
void setup() { void setup() {
cli();
Serial.begin(115200); Serial.begin(115200);
Wire.begin(8); Wire.begin(8);
Wire.onReceive(receiveEvent); Wire.onReceive(receiveEvent);
Wire.onRequest(requestEvent); Wire.onRequest(requestEvent);
Serial.println("Hello!"); Serial.println("Hello!");
eggStepperRPM = servoStepperRPM = curRPM; eggStepperRPM = servoStepperRPM = curRPM;
OCR2 = 250; pinMode(A0, OUTPUT);
TCCR2 |= (1 << WGM20) | (1 << CS22); digitalWrite(A0, true);
TIMSK |= (1 << OCIE2); OCR0A = 250;
sei(); TCCR0A |= (1 << WGM20) | (1 << CS22);
TIMSK0 |= (1 << OCIE0A);
servoStepper.setPos(X_LIMIT); servoStepper.setPos(X_LIMIT);
pen.init(); pen.init();
} }
unsigned int ms = 0; unsigned int ms = 0;
ISR(TIMER2_COMP_vect) { ISR(TIMER0_COMPA_vect) {
ms++; ms++;
if (ms % adjustDelay == 0) { if (ms % adjustDelay == 0) {
adjustRPM(); adjustRPM();