commit 9365cbb259690f19e6ba337f108a9a8d658df65a
parent 5b235286754032a59fe38edc01edf32cf7b8e1f4
Author: thing1 <thing1@seacrossedlovers.xyz>
Date: Thu, 6 Nov 2025 09:01:58 +0000
worked on robot
Diffstat:
7 files changed, 187 insertions(+), 5 deletions(-)
diff --git a/CS12020/03.11.25.md b/CS12020/03.11.25.md
@@ -0,0 +1,3 @@
+03/11/25
+========
+
diff --git a/CS12020/robot/run/Makefile b/CS12020/robot/run/Makefile
@@ -0,0 +1,10 @@
+all: compile upload
+
+upload: compile
+ arduino-cli upload --fqbn arduino:avr:uno . -p /dev/ttyACM0
+
+compile: run.ino
+ arduino-cli compile --fqbn arduino:avr:uno .
+
+monitor:
+ arduino-cli monitor -p /dev/ttyACM0
diff --git a/CS12020/robot/run/instructions.h b/CS12020/robot/run/instructions.h
@@ -0,0 +1,60 @@
+#include <Servo.h>
+#include "util.h"
+
+enum DIRECTIONS {
+ FWD = 1,
+ BWD = -1,
+ LFT = -2,
+ RGT = 2
+};
+
+typedef struct instructions {
+ int dir, unit;
+ struct instructions *next;
+} instructions;
+
+void
+stepMove(int dir) {
+ servoA.write(SERVOA_ZERO + (40 * dir));
+ servoB.write(SERVOA_ZERO - (40 * dir));
+ delay(10);
+ servoA.write(SERVOA_ZERO);
+ servoB.write(SERVOA_ZERO);
+}
+
+void
+stepTurn(int dir) {
+ servoA.write(SERVOA_ZERO + (10 * dir));
+ servoB.write(SERVOA_ZERO - (10 * -dir));
+ delay(10);
+ servoA.write(SERVOA_ZERO);
+ servoB.write(SERVOA_ZERO);
+}
+
+void
+rotate(int x) {
+ int dir = (x < 0) ? -1 : 1;
+ x = (x < 0) ? -x : x;
+
+ int y = (int)(1.666666 * (float)x);
+
+ for (int i = 0; i < y; i++)
+ stepTurn(dir);
+}
+
+void
+runInstructions(instructions *ins) {
+ switch (ins->dir) {
+ case FWD:
+ case BWD:
+ for (int i = 0; i < ins->unit; i++)
+ stepMove(ins->dir);
+ break;
+ case LFT:
+ case RGT:
+ rotate(ins->unit * (ins->dir / 2));
+ break;
+ }
+ if (ins->next)
+ runInstructions(ins->next);
+}
diff --git a/CS12020/robot/run/run.ino b/CS12020/robot/run/run.ino
@@ -0,0 +1,18 @@
+#include <Servo.h>
+#include "instructions.h"
+
+void
+setup() {
+ setupRobot();
+
+ instructions i1;
+
+ instructions i2 = {LFT, 90, &i1};
+ i1 = {FWD, 2000, &i2};
+
+ runInstructions(&i1);
+
+ delay(20000);
+}
+
+void loop() {}
diff --git a/CS12020/robot/run/util.h b/CS12020/robot/run/util.h
@@ -0,0 +1,73 @@
+#define GREEN_LED 7
+#define YELLOW_LED 12
+#define RED_LED 13
+
+#define BUTTONA 4
+#define BUTTONB 2
+
+#define SERVOA_PIN 6
+#define SERVOB_PIN 5
+
+#define SERVOA_ZERO 96
+#define SERVOB_ZERO 96
+
+#define SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
+
+Servo servoA;
+Servo servoB;
+
+void
+setupRobot() {
+ Serial.begin(9800);
+ pinMode(GREEN_LED, OUTPUT);
+ pinMode(YELLOW_LED, OUTPUT);
+ pinMode(RED_LED, OUTPUT);
+ pinMode(BUTTONA, INPUT);
+ pinMode(BUTTONB, INPUT);
+ pinMode(SERVOA_PIN, OUTPUT);
+ pinMode(SERVOB_PIN, OUTPUT);
+ servoA.attach(SERVOA_PIN);
+ servoB.attach(SERVOB_PIN);
+ servoA.write(SERVOA_ZERO);
+ servoB.write(SERVOB_ZERO);
+}
+
+void
+setLEDs(int g, int y, int r) {
+ digitalWrite(GREEN_LED, g);
+ digitalWrite(YELLOW_LED, y);
+ digitalWrite(RED_LED, r);
+}
+
+void
+waitButton(int pin, int state) {
+ while (digitalRead(pin) == state) ;
+}
+
+void
+debounce(int pin) {
+ waitButton(pin, LOW);
+ delay(20);
+ waitButton(pin, HIGH);
+ delay(20);
+}
+
+void
+SEprintf(const char *fmt, ...) {
+ static char sbuf[64] = { 0 };
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsnprintf(sbuf, 64, fmt, ap);
+ va_end(ap);
+
+ Serial.print(sbuf);
+}
+
+int
+readint() {
+ while (!Serial.available()) ;
+ int i = Serial.parseInt();
+ SEprintf("\n");
+ return i;
+}
diff --git a/CS18120/pres/notes.md b/CS18120/pres/notes.md
@@ -5,18 +5,23 @@ notes for presentation
- meet next wednesday same time, same place
- plan rehersals for closer to the time
-- intro should be short and sweet ~ 3mins
+- 22 ish slides
-- codenames - lucas ~ 6 mins
+- intro should be short and sweet ~ 3mins 3-4 slides
+ - meme comp
+
+- codenames - lucas ~ 6 mins 4-5 slides
- send a message - lucas
- bring up the stats in this section
-- quiz - jaidia ~ 6 mins
+- quiz - jaidia ~ 6 mins 4-5 slides
- zoom - jaidia
-- bitoblisk - dean
+- bitoblisk - dean ~6mins 4-5 slides
- device - dean
-- conclusion should be lots of stats, overview of the day ~ 7 mins
+- conclusion should be lots of stats, overview of the day ~ 7 mins 3-4 slides
- show how the day was succesful, making connections with group
+
+- meet again on monday 1:30
diff --git a/MP10610/04.11.25.md b/MP10610/04.11.25.md
@@ -0,0 +1,13 @@
+04/11/25
+========
+
+- see FIG1 on how to do intergration by substitution
+ - note that we use x ^ 2 dx = du / 3 to cancel things out
+ - we write it in terms of du
+- see FIG2 for the formal defintion of intergration by substitution
+ - if you intergrate the chain rule, you should get this
+ - note when doing a definite intergral, the limits change to g(b) and g(a)
+ - if you convert everything back to x from u, before doing the intergration this isn't needed
+- see FIG3 for a worked example of a substituion
+- see FIG4 for some helpful tricks on odd and even functions
+ - not needed to be known, just makes things faster