-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
120 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,65 @@ | ||
|
||
#!/bin/bash | ||
echo ""Miharix WiFi RC"" | ||
read -p "Zacnem programirati? Y/[N] : " programiraj | ||
# | ||
# Elapsed time. Usage: | ||
# | ||
# t=$(timer) | ||
# ... # do something | ||
# printf 'Elapsed time: %s\n' $(timer $t) | ||
# ===> Elapsed time: 0:01:12 | ||
# | ||
#https://www.linuxjournal.com/content/use-date-command-measure-elapsed-time | ||
##################################################################### | ||
# If called with no arguments a new timer is returned. | ||
# If called with arguments the first is used as a timer | ||
# value and the elapsed time is returned in the form HH:MM:SS. | ||
# | ||
function timer() | ||
{ | ||
if [[ $# -eq 0 ]]; then | ||
echo $(date '+%s') | ||
else | ||
local stime=$1 | ||
etime=$(date '+%s') | ||
|
||
if [[ -z "$stime" ]]; then stime=$etime; fi | ||
|
||
dt=$((etime - stime)) | ||
ds=$((dt % 60)) | ||
dm=$(((dt / 60) % 60)) | ||
dh=$((dt / 3600)) | ||
printf '%d:%02d:%02d' $dh $dm $ds | ||
fi | ||
} | ||
|
||
# If invoked directly run test code. | ||
if [[ $(basename $0 .sh) == 'timer' ]]; then | ||
t=$(timer) | ||
read -p 'Enter when ready...' p | ||
printf 'Elapsed time: %s\n' $(timer $t) | ||
fi | ||
|
||
## vim: tabstop=4: shiftwidth=4: noexpandtab: | ||
## kate: tab-width 4; indent-width 4; replace-tabs false; | ||
|
||
#glavna koda | ||
|
||
echo "Miharix WiFi RC" | ||
stevec=0 | ||
cas=$(timer) | ||
read -p "Začnem programirati? Y/[N] : " programiraj | ||
programiraj=${programiraj:="n"} | ||
while [ $programiraj == 'y' ] || [ $programiraj == 'Y' ] | ||
do | ||
echo "Zaganjam programiranje" | ||
stevec=$((stevec+1)) | ||
printf '\nZaganjam programiranje %s. vezja\n' $stevec | ||
|
||
esptool.py --port /dev/ttyUSB0 write_flash 0x000000 socket-6servo-advance.ino.bin 0x300000 socket-6servo-advance.spiffs.bin | ||
|
||
echo "Programiranje končano" | ||
printf '\nProgramiranje %s. vezja končano\n\n' $stevec | ||
|
||
read -p "Zacnem programirati naslednjega? [Y]/N : " programiraj | ||
read -p "Začnem programirati naslednjega? [Y]/N : " programiraj | ||
programiraj=${programiraj:="y"} | ||
done | ||
done | ||
printf '\n\nSprogramiranih je bilo %s vezij\n' $stevec | ||
printf 'Za kar je bilo potrebno %s časa\n\n' $(timer $cas) |
Binary file modified
BIN
+0 Bytes
(100%)
Arduino/socket/socket-6servo-advance/bin/socket-6servo-advance.spiffs.bin
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!--http://twiggle-web-design.com/tutorials/Custom-Vertical-Input-Range-CSS3.html--> | ||
<html><head><title>Miharix WiFi RC</title> | ||
<script src='control15.js' charset='utf-8'></script> | ||
<link rel="icon" type="image/png" href="icona.png" /> | ||
<link rel="stylesheet" type="text/css" href="control3.css"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/> | ||
</head> | ||
<body> | ||
|
||
Miharix WiFi RC | ||
<input id='S1' class='range horizontal-lowest-first round servo1' type='range' oninput='sendServo();' onmouseup='S1Up()' ontouchend='S1Up()' onmouseout='S1Up()' min='0' max='180' step='1' value='90' > | ||
|
||
<input id='S2' class='range horizontal-lowest-first round servo2' type='range' oninput='sendServo();' onmouseup='S2Up()' ontouchend='S2Up()' onmouseout='S2Up()' min='0' max='180' step='1' value='90' > | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var Servo1=0; | ||
var Servo2=0; | ||
var Servo3=0; | ||
var Servo4=0; | ||
var Servo5=0; | ||
var Servo6=0; | ||
|
||
var connection = new WebSocket('ws://'+location.hostname+':81/', ['arduino']); | ||
connection.onopen = function () { | ||
// connection.send('Connect ' + new Date()); | ||
}; | ||
connection.onerror = function (error) { | ||
console.log('WebSocket Error ', error); | ||
}; | ||
connection.onmessage = function (e) { | ||
// console.log('Server: ', e.data); | ||
}; | ||
function sendServo(){ | ||
|
||
var S1 = parseInt(document.getElementById('S1').value).toString(16); | ||
var S2 = parseInt(document.getElementById('S2').value).toString(16); | ||
var S3 = 90; | ||
var S4 = 90; | ||
var S5 = 90; | ||
var S6 = 90; | ||
|
||
if(S1.length < 2) { S1 = '0' + S1; } | ||
if(S2.length < 2) { S2 = '0' + S2; } | ||
if(S3.length < 2) { S3 = '0' + S3; } | ||
if(S4.length < 2) { S4 = '0' + S4; } | ||
if(S5.length < 2) { S5 = '0' + S5; } | ||
if(S6.length < 2) { S6 = '0' + S6; } | ||
|
||
var S1_6 = S1+S2+S3+S4+S5+S6; | ||
// console.log('S1_6: ' + S1_6); | ||
connection.send('S'+S1_6+'\n'); | ||
} | ||
|
||
function S2Up(){ | ||
//document.getElementById('S2').value=90; | ||
sendServo(); | ||
} | ||
function S1Up(){ | ||
//document.getElementById('S1').value=90; | ||
sendServo(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters