Commit 2e693c8a0e386fec58e0b51ed20eb87b1491f0eb

Commits
[COMMIT BEGIN]
commit 2e693c8a0e386fec58e0b51ed20eb87b1491f0eb
Author: 0x4248 <[email protected]>
Date:   Sun Mar 15 08:58:20 2026 +0000

    felix: add buzzer and init service

diff --git a/systems/arduino/buzzer/buzzerd.py b/systems/arduino/buzzer/buzzerd.py
new file mode 100644
index 0000000..898c02d
--- /dev/null
+++ b/systems/arduino/buzzer/buzzerd.py
@@ -0,0 +1,13 @@
+import serial
+
+SERIAL="/dev/ttyACM0"
+PIPE="/tmp/buzzer"
+
+ser = serial.Serial(SERIAL,115200)
+
+print("buzzer daemon started")
+
+while True:
+    with open(PIPE,"r") as f:
+        for line in f:
+            ser.write((line.strip()+"\n").encode())
\ No newline at end of file
diff --git a/systems/arduino/buzzer/firmware.ino b/systems/arduino/buzzer/firmware.ino
new file mode 100644
index 0000000..f86f498
--- /dev/null
+++ b/systems/arduino/buzzer/firmware.ino
@@ -0,0 +1,39 @@
+const int buzzer = 8;
+
+String cmd = "";
+
+void setup() {
+  pinMode(buzzer, OUTPUT);
+  Serial.begin(115200);
+}
+
+void loop() {
+  while (Serial.available()) {
+    char c = Serial.read();
+
+    if (c == '\n') {
+      process(cmd);
+      cmd = "";
+    } else if (c != '\r') {
+      cmd += c;
+    }
+  }
+}
+
+void process(String s) {
+
+  if (s.length() == 0) return;
+
+  if (s[0] == 'd') {
+    int ms = s.substring(1).toInt();
+    delay(ms);
+    return;
+  }
+
+  int freq = s.toInt();
+
+  if (freq <= 0)
+    noTone(buzzer);
+  else
+    tone(buzzer, freq);
+}
\ No newline at end of file
diff --git a/systems/arduino/buzzer/init.sh b/systems/arduino/buzzer/init.sh
new file mode 100644
index 0000000..50a40ac
--- /dev/null
+++ b/systems/arduino/buzzer/init.sh
@@ -0,0 +1,14 @@
+# Setup arduino buzzer
+
+# Dont sleep, we need to set permissions on the device
+chmod a+rw /dev/ttyACM0
+stty -F /dev/ttyACM0 115200 raw -echo
+
+mkfifo /tmp/buzzer
+chmod 666 /tmp/buzzer
+
+python3 buzzerd.py &
+
+echo 500 > /tmp/buzzer
+sleep 1
+echo 0 > /tmp/buzzer
\ No newline at end of file
diff --git a/systems/linux/dotfiles/felix/home/felix/buzzerd/buzzerd.py b/systems/linux/dotfiles/felix/home/felix/buzzerd/buzzerd.py
new file mode 100644
index 0000000..898c02d
--- /dev/null
+++ b/systems/linux/dotfiles/felix/home/felix/buzzerd/buzzerd.py
@@ -0,0 +1,13 @@
+import serial
+
+SERIAL="/dev/ttyACM0"
+PIPE="/tmp/buzzer"
+
+ser = serial.Serial(SERIAL,115200)
+
+print("buzzer daemon started")
+
+while True:
+    with open(PIPE,"r") as f:
+        for line in f:
+            ser.write((line.strip()+"\n").encode())
\ No newline at end of file
diff --git a/systems/linux/dotfiles/felix/home/felix/buzzerd/init.sh b/systems/linux/dotfiles/felix/home/felix/buzzerd/init.sh
new file mode 100644
index 0000000..0f5cb68
--- /dev/null
+++ b/systems/linux/dotfiles/felix/home/felix/buzzerd/init.sh
@@ -0,0 +1,17 @@
+# Setup arduino buzzer
+
+if [ ! -e /dev/ttyACM0 ]; then
+    echo "Error: /dev/ttyACM0 not found. Please connect the Arduino device and try again."
+    exit 1
+fi
+chmod a+rw /dev/ttyACM0
+stty -F /dev/ttyACM0 115200 raw -echo
+
+mkfifo /tmp/buzzer
+chmod 666 /tmp/buzzer
+
+python3 buzzerd.py &
+
+echo 500 > /tmp/buzzer
+sleep 1
+echo 0 > /tmp/buzzer
\ No newline at end of file
diff --git a/systems/linux/dotfiles/felix/home/felix/felix_init.sh b/systems/linux/dotfiles/felix/home/felix/felix_init.sh
new file mode 100644
index 0000000..919eac6
--- /dev/null
+++ b/systems/linux/dotfiles/felix/home/felix/felix_init.sh
@@ -0,0 +1,4 @@
+bash /root/felix/buzzerd/init.sh
+# do a tune EOF
+# API is d# for delay and # for buzzer value but it needs to be in a single echo new line separated string
+echo -e "d1000\n500\nd1000\n0" > /tmp
\ No newline at end of file
diff --git a/systems/linux/dotfiles/felix/home/felix/systemd/felix.service b/systems/linux/dotfiles/felix/home/felix/systemd/felix.service
new file mode 100644
index 0000000..491eb16
--- /dev/null
+++ b/systems/linux/dotfiles/felix/home/felix/systemd/felix.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Felix Console Init
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/root/felix/felix_init.sh
+Restart=always
+User=root
+
+[Install]
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/systems/linux/dotfiles/felix/home/felix/systemd/install.sh b/systems/linux/dotfiles/felix/home/felix/systemd/install.sh
new file mode 100644
index 0000000..3facd3c
--- /dev/null
+++ b/systems/linux/dotfiles/felix/home/felix/systemd/install.sh
@@ -0,0 +1,17 @@
+# install the felix systemd service
+
+cp /root/felix/systemd/felix.service /etc/systemd/system/
+systemctl enable felix.service
+echo "Felix service installed. Please reboot to start the service."
+consent=""
+
+while [[ ! "$consent" =~ ^[Yy]$ ]]; do
+    read -p "Do you want to reboot now? (y/n) " consent
+    if [[ "$consent" =~ ^[Yy]$ ]]; then
+        clear
+        echo "Felix service installer is rebooting the system to start the service. Please wait..."
+        systemctl reboot
+    else
+        exit 0
+    fi
+done
\ No newline at end of file
[COMMIT END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.