uni

Thing1's amazing uni repo
Log | Files | Refs

commit 931503bedc526b0f8a0a009fb41bd68d9712908a
parent 77906b5f6b19ddb1f51da461b4a50d4284f2c0cf
Author: thing1 <thing1@seacrossedlovers.xyz>
Date:   Wed,  8 Oct 2025 10:02:21 +0100

had a lab

Diffstat:
RCS12020/labs/task3/task3.ino -> CS12020/labs/lab1/task3/task3.ino | 0
RCS12020/labs/task4-6/task4-6.ino -> CS12020/labs/lab1/task4-6/task4-6.ino | 0
ACS12020/labs/lab2/algo.md | 5+++++
ACS12020/labs/lab2/triathlon/triathlon.ino | 64++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ACS18120/07.10.25.md | 4++++
AMP10610/07.10.25.md | 38++++++++++++++++++++++++++++++++++++++
Ateaching/a.out | 0
Ateaching/test | 0
Ateaching/test.c | 6++++++
9 files changed, 117 insertions(+), 0 deletions(-)

diff --git a/CS12020/labs/task3/task3.ino b/CS12020/labs/lab1/task3/task3.ino diff --git a/CS12020/labs/task4-6/task4-6.ino b/CS12020/labs/lab1/task4-6/task4-6.ino diff --git a/CS12020/labs/lab2/algo.md b/CS12020/labs/lab2/algo.md @@ -0,0 +1,5 @@ +- have a function that reads time in hours, mins seconds + - store the data in a struct that is passed by reference to the input function +- make a function that adds 3 time values + - make it check if a value is over 60 and add to the next col + - do this via dividing the total diff --git a/CS12020/labs/lab2/triathlon/triathlon.ino b/CS12020/labs/lab2/triathlon/triathlon.ino @@ -0,0 +1,64 @@ +struct time { int hours, mins, secs; }; + +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()) ; + return Serial.parseInt(); +} + +void +readtime(const char *sport, struct time *t) { + SEprintf("How many hours did %s take: ", sport); + t->hours = readint(); + Serial.println(); + + SEprintf("How many mins did %s take: ", sport); + t->mins = readint(); + Serial.println(); + + SEprintf("How many secs did %s take: ", sport); + t->secs = readint(); + Serial.println(); +} + +void +addtimes(struct time t1, struct time t2, struct time t3, struct time *res) { + int scarry = 0, mcarry = 0; + + res->secs = t1.secs + t2.secs + t3.secs; + scarry = (res->secs / 60); + res->secs %= 60; + + res->mins = t1.mins + t2.mins + t3.mins + scarry; + mcarry = (res->mins / 60); + res->mins %= 60; + + res->hours = t1.hours + t2.hours + t3.hours + mcarry; +} + +void +setup() { + struct time t1, t2, t3, res; + Serial.begin(9600); + + readtime("swim", &t1); + readtime("cycle", &t2); + readtime("run", &t3); + + addtimes(t1, t2, t3, &res); + SEprintf("Total time: %dhr %dmin %dsec.\n", res.hours, res.mins, res.secs); +} + +void +loop() { +} diff --git a/CS18120/07.10.25.md b/CS18120/07.10.25.md @@ -0,0 +1,4 @@ +07/10/25 +======== + +- Don't hack the US DOD diff --git a/MP10610/07.10.25.md b/MP10610/07.10.25.md @@ -0,0 +1,38 @@ +07/10/25 +======== + +exp +--- +- see FIG1 for exp funcs +- e^x has the derivative of e^x +- it crosses at (0, 1) +- never crosses the x axis + +log +--- +- see FIG2 for exp funcs +- ln(x) is a mirror of e^x along y=x +- ln(x) has the derivative of 1/x +- never crosses the y axis + +even and odd functions +---------------------- +- if FIG3 is true for all values of x then the function is even +- x^2 is an even function +- see FIG4 for the definiton of an odd function +- y = x is an odd function +- see FIG7 for how to split a function into even and odd parts +- see FIG8 for how to split e^x + +hyberbolic functions +-------------------- +- note that fo(x) = sinH(x) not sin(x), it is sin hyberbolic in FIG8 not +- fe(x) in FIG8 is cosH(x) +- tanH(x) is sinH(x) / cosH(x) + +combining functions +------------------- +- see FIG10 for combining functions + + + diff --git a/teaching/a.out b/teaching/a.out diff --git a/teaching/test b/teaching/test Binary files differ. diff --git a/teaching/test.c b/teaching/test.c @@ -0,0 +1,6 @@ +#include "stdio.h" + +int main() { + printf("hello world\n"); + return 0; +}