PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Voltage Divider Calculator For Linux Bash

Go down

Voltage Divider Calculator For Linux Bash  Empty Voltage Divider Calculator For Linux Bash

Post by jamied_uk 26th August 2017, 00:42

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
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Voltage Divider Calculator For Linux Bash  Empty Re: Voltage Divider Calculator For Linux Bash

Post by jamied_uk 26th August 2017, 01:17

This is a working progress!!!
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum