Upload files to "/"
This commit is contained in:
43
srvo
Normal file
43
srvo
Normal file
@@ -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
|
||||||
38
srvoc
Normal file
38
srvoc
Normal file
@@ -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.h>
|
||||||
|
|
||||||
|
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
|
||||||
31
srvop
Normal file
31
srvop
Normal file
@@ -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.h>
|
||||||
|
|
||||||
|
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
|
||||||
Reference in New Issue
Block a user