Voltage Divider Calculator For Linux Bash
Page 1 of 1
Voltage Divider Calculator For Linux Bash
Linux Bash Code Script
- Code:
#!/bin/bash
clear
echo "(c) J~Net 2017"
echo "jnet.forumotion.com/t1551-voltage-divider-calculator-for-linux-bash#2357"
echo ""
echo "This will help you determine which resister values are required"
echo "for voltage divider circuits."
echo ""
echo ""
echo "Input Voltage"
read in_voltage
echo "Desired Output Voltage"
read out_voltage
echo ""
echo "Ok Input Voltage $in_voltage and Output Voltage $out_voltage"
echo ""
echo "What fraction $out_voltage is of $in_voltage"
echo ""
echo "The fraction Is "
echo ""
total=$(echo "scale=2;$in_voltage-$out_voltage" | bc)
#
total_d=$(echo "scale=2;$in_voltage-$out_voltage" | bc)
#
fraction="1:$total"
echo "$fraction"
echo "Resister Value 1 = 1000 Ohm"
echo ""
total2=$(echo "scale=2;$total/$total_d" | bc) # -$out_voltage
total3=$(echo "scale=2;$total2*$total" | bc) # -$out_voltage
echo ""
echo "Resister Value 2 = $total3 K Ohms"
Last edited by jamied_uk on 26th August 2017, 05:17; edited 1 time in total
Similar topics
» Linux Bash Dog Age Calculator Script
» Bash Percentage Calculator For Linux
» Light Speed Calculator For Linux Bash
» Bash Wattage Calculator
» Bash Time Or Distance Calculator
» Bash Percentage Calculator For Linux
» Light Speed Calculator For Linux Bash
» Bash Wattage Calculator
» Bash Time Or Distance Calculator
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum