From 7a23dca68fa7ab474ea66935bc9160738b73a3c7 Mon Sep 17 00:00:00 2001 From: bmixed Date: Tue, 14 Apr 2026 20:35:49 +0000 Subject: [PATCH] Upload files to "/" --- srvo | 43 +++++++++++++++++++++++++++++++++++++++++++ srvoc | 38 ++++++++++++++++++++++++++++++++++++++ srvop | 31 +++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 srvo create mode 100644 srvoc create mode 100644 srvop diff --git a/srvo b/srvo new file mode 100644 index 0000000..11e8ca8 --- /dev/null +++ b/srvo @@ -0,0 +1,43 @@ +#!/bin/bash + +#SRVO - SERVO SELECTOR - [PORT] + [FQBN] +#sudo apt install arduino-cli +#sudo apt install curl +#curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh +arduino-cli core install arduino:avr +arduino-cli lib install Servo +clear +arduino-cli board list +echo "SET SERVO SERIAL PORT [PORT]:" +read -r port +echo "SET SERVO BOARD [FQBN]:" +read -r fqbn +export port +export fqbn +echo -n " +SET POSITION OR CONTINUIOUS SPEED? +========================================= +1 - SET POSTITION +2 - SET CONTINUIOUS POSITIONS AND SPEED +0 - EXIT +" +read opt +case $opt in +1) +./srvop +;; +2) +./srvoc +;; +0) +clear +exit +;; +*) +clear +echo "Invalid input" +./srvo +;; +esac +clear +./srvo diff --git a/srvoc b/srvoc new file mode 100644 index 0000000..7b1f56b --- /dev/null +++ b/srvoc @@ -0,0 +1,38 @@ +#!/bin/bash + +#SRVOC - SERVO CONTINUIOS - VARIABLE POSITION AND SPEED [DEGREES] + [DELAY] +#sudo apt install arduino-cli +#source srvo +clear +echo "SET SERVO START POSITION [DEGREES]:" +read -r spos +echo "SET SERVO END POSITION [DEGREES]:" +read -r epos +echo "SET SERVO SPEED [DELAY]:" +read -r dl +mkdir -p ./servo/ +echo " +#include + +Servo servo0; // Create a servo object + +void setup() { + servo0.attach(9); // Attach the servo to pin 9 +} + +void loop() { + for (int pos = $spos; pos <= $epos; pos += 1) { // Move from 0 to 180 degrees + servo0.write(pos); // Tell servo to go to position in variable 'pos' + delay($dl); // Wait for the servo to reach the position + } + for (int pos = $epos; pos >= $spos; pos -= 1) { // Move back from 180 to 0 degrees + servo0.write(pos); // Tell servo to go to position in variable 'pos' + delay($dl); // Wait for the servo to reach the position + } +} +" | tee ./servo/servo.ino #>> ./servo/servo.ino +#arduino-cli lib install Servo +arduino-cli compile --fqbn $fqbn --port /dev/tty$port ./servo/servo.ino +arduino-cli upload --fqbn $fqbn --port /dev/tty$port ./servo/servo.ino +clear +./srvoc diff --git a/srvop b/srvop new file mode 100644 index 0000000..b315078 --- /dev/null +++ b/srvop @@ -0,0 +1,31 @@ +#!/bin/bash + +#SRVOP - SERVO POSITIOIN - VARIABLE POSITION [DEGREES] +#sudo apt install arduino-cli +#source srvo +clear +echo "SET SERVO POSITION [DEGREES]:" +read -r pos +mkdir -p ./servo/ +echo " +#include + +Servo servo; // Create a servo object + +void setup() { + // put your setup code here, to run once: + servo.attach(9); // Attach the servo to pin + servo.write($pos); // Tell servo to go to position in variable 'pos' + delay(0); // Wait for the servo to reach the position +} + +void loop() { + // put your main code here, to run repeatedly: + +} +" | tee ./servo/servo.ino #>> ./servo/servo.ino +#arduino-cli lib install Servo +arduino-cli compile --fqbn $fqbn --port /dev/tty$port ./servo/servo.ino +arduino-cli upload --fqbn $fqbn --port /dev/tty$port ./servo/servo.ino +clear +./srvop