Compare commits
2 Commits
e2ea10152d
...
1233d07a1c
Author | SHA1 | Date |
---|---|---|
radex | 1233d07a1c | |
radex | 534d11741c |
|
@ -2,14 +2,6 @@
|
|||
#include "constants.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
void helloBuzz() {
|
||||
tone(BUZZER_PIN, 500, 100);
|
||||
delay(100);
|
||||
tone(BUZZER_PIN, 1000, 100);
|
||||
delay(100);
|
||||
tone(BUZZER_PIN, 4000, 100);
|
||||
}
|
||||
|
||||
void happyBuzz() {
|
||||
tone(BUZZER_PIN, 1500, 50);
|
||||
delay(75);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
void helloBuzz();
|
||||
void happyBuzz();
|
||||
void sadBuzz();
|
||||
void beep();
|
||||
|
|
|
@ -30,6 +30,6 @@
|
|||
|
||||
// --- Z axis motor
|
||||
|
||||
#define STEPPER_ENABLE 8
|
||||
#define STEPPER_DIR 9
|
||||
#define STEPPER_STEP 10
|
||||
#define STEPPER_ENABLE 10
|
||||
#define STEPPER_DIR 8
|
||||
#define STEPPER_STEP 9
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "debug.h"
|
||||
#include "timer.h"
|
||||
#include "stepper.h"
|
||||
#include "memes.h"
|
||||
|
||||
void setup() {
|
||||
setupDebug();
|
||||
|
@ -22,14 +23,12 @@ void setup() {
|
|||
fatal();
|
||||
}
|
||||
|
||||
helloBuzz();
|
||||
splashScreen();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// debugScanI2C();
|
||||
// demoScreen();
|
||||
// demoStepper();
|
||||
|
||||
void loop() {
|
||||
debugScanI2C();
|
||||
demoTimer();
|
||||
|
||||
auto key = handleKeyboard();
|
||||
|
@ -53,8 +52,6 @@ void loop() {
|
|||
sadBuzz();
|
||||
} else if (key == KEY_C) {
|
||||
beep();
|
||||
} else if (key == KEY_D) {
|
||||
tick();
|
||||
} else {
|
||||
tick();
|
||||
}
|
||||
|
@ -68,5 +65,6 @@ void loop() {
|
|||
if (auto event = handleEncoder()) {
|
||||
tick();
|
||||
Serial.println(event == ENCODER_CLOCKWISE ? "Clockwise" : "Counter-clockwise");
|
||||
demoStepper(event == ENCODER_CLOCKWISE ? LOW : HIGH);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
#include <Arduino.h>
|
||||
|
||||
#include "screen.h"
|
||||
#include "buzzer.h"
|
||||
#include "constants.h"
|
||||
|
||||
void splashScreen() {
|
||||
// lcd is slow, so we have to issue commands sufficiently early
|
||||
// to synchronize with the hello buzz
|
||||
lcd.clear();
|
||||
lcd.print(" cewk");
|
||||
delay(100);
|
||||
tone(BUZZER_PIN, 500, 180);
|
||||
delay(20);
|
||||
lcd.print("-o-");
|
||||
delay(100);
|
||||
tone(BUZZER_PIN, 1000, 180);
|
||||
delay(20);
|
||||
lcd.print("mator");
|
||||
delay(100);
|
||||
tone(BUZZER_PIN, 4000, 180);
|
||||
delay(500);
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print(" HSWAW 2024 ");
|
||||
delay(300);
|
||||
lcd.setCursor(0, 1);
|
||||
lcd.print("by");
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
void splashScreen();
|
|
@ -17,8 +17,3 @@ bool setupScreen() {
|
|||
lcd.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
void demoScreen() {
|
||||
lcd.print(" cewk-o-mator ");
|
||||
lcd.print(" HSWAW 2024 ");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <LCD_I2C.h>
|
||||
|
||||
extern LCD_I2C lcd;
|
||||
|
||||
bool setupScreen();
|
||||
void demoScreen();
|
||||
|
|
|
@ -10,16 +10,12 @@ void setupStepper() {
|
|||
digitalWrite(STEPPER_ENABLE, LOW);
|
||||
}
|
||||
|
||||
bool stepperDir = HIGH;
|
||||
|
||||
void demoStepper() {
|
||||
Serial.println("Demoing stepper motor - rotating 200 steps");
|
||||
stepperDir = !stepperDir;
|
||||
digitalWrite(STEPPER_DIR, stepperDir);
|
||||
for (int i = 0; i < 200; i++) {
|
||||
void demoStepper(bool dir) {
|
||||
digitalWrite(STEPPER_DIR, dir);
|
||||
for (int i = 0; i < 3200; i++) {
|
||||
digitalWrite(STEPPER_STEP, HIGH);
|
||||
delay(2);
|
||||
delayMicroseconds(25);
|
||||
digitalWrite(STEPPER_STEP, LOW);
|
||||
delay(7);
|
||||
delayMicroseconds(25);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
|
||||
void setupStepper();
|
||||
void demoStepper();
|
||||
void demoStepper(bool dir);
|
||||
|
|
Loading…
Reference in New Issue