slayerpaul Posted March 12, 2013 Share Posted March 12, 2013 ;D Link to comment Share on other sites More sharing options...
Iv000 Posted March 12, 2013 Share Posted March 12, 2013 I started scripting in Python after going through a tutorial or two and I must say, I'm getting pretty good at it. I just have to keep practicing. :thumbsup: Already wrote a 120 lines long script for calculating resistor values for LED diodes, I'm just too lazy to calculate that in my head. :PYou go girl! :P Link to comment Share on other sites More sharing options...
gaminggriffin Posted March 12, 2013 Share Posted March 12, 2013 I'm back, what happened? Link to comment Share on other sites More sharing options...
Iv000 Posted March 12, 2013 Share Posted March 12, 2013 http://d24w6bsrhbeh9d.cloudfront.net/photo/6780857_460s_v1.jpg Link to comment Share on other sites More sharing options...
Werne Posted March 12, 2013 Share Posted March 12, 2013 I started scripting in Python after going through a tutorial or two and I must say, I'm getting pretty good at it. I just have to keep practicing. :thumbsup: Already wrote a 120 lines long script for calculating resistor values for LED diodes, I'm just too lazy to calculate that in my head. :PYou go girl! :PI have too much penis to be a girl. :wink: In other news, I just finished the script. :dance: Since I'm still inexperienced in Python, I call a definition that requires "return" value while I use a "print" value for the end result. Works like a charm but it shows "None" at the end of the result, not a big deal for me. Also reduced it down to 106 lines, removed some junk and worthless descriptions I used while I wrote it. Here's the script, it's the first portable LED resistor calculator I've seen so far, and I've been looking for one in quite a while: #Definicija convertString za koristenje u formuli. def convertString(str): try: returnValue = float(str) except ValueError: returnValue = bool(str) return returnValue #Definicije i formule za razlicite spojeve. #X je broj dioda u spoju. #Osnovna formula (Vs - Vl) / I def single(a, b, c, e): print "Resistor Value: ", (convertString(a) - convertString(b)) / convertString(c) print "Resistor wattage: ", (convertString(a) - convertString(b)) * convertString(c) print "Safe-to-use resistor wattage: ", ((convertString(a) - convertString(b)) * convertString(c)) * convertString(e) print "\n" #Formula za racunanje serijskog spoja (Vs - (Vl * X)) / I def serial(a, b, c, d, e): print "Resistor Value: ", (convertString(a) - (convertString(b) * convertString(d))) / convertString(c) print "Resistor wattage: ", (convertString(a) - (convertString(b) * convertString(d))) * convertString(c) print "Safe-to-use resistor wattage: ", ((convertString(a) - (convertString(b) * convertString(d))) * convertString(c)) * convertString(e) print "\n" #Formula za racunanje paralelnog spoja (Vs - Vl) / (I * X) def parallel(a, b, c, d, e): print "Resistor Value: ", (convertString(a) - convertString(b)) / (convertString(c) * convertString(d)) print "Resistor wattage: ", (convertString(a) - convertString(b)) * (convertString(c) * convertString(d)) print "Safe-to-use resistor wattage: ", ((convertString(a) - convertString(b)) * (convertString(c) * convertString(d))) * convertString(e) print "\n" keepProgramRunning = True #Izbornik sa spojevima i volazama dioda. print "Welcome to Werne's LED Calculator!" print " " print "Common LED voltages:" print " " print "Infra-Red LED - 1.5V" print "Red LED - 2.0V" print "Orange LED - 2.0V" print "Yellow LED - 2.1V" print "Green LED - 2.2V" print "Real Green LED - 3.3V" print "Blue LED - 3.3V" print "White LED - 3.3V" print "Ultra-Violet LED - 3.3V" print "Blue (430 nm) LED - 4.6V" print "\n" while keepProgramRunning: print " " print "Select type of connection:" print " " print "1: Single Diode" print "2: Serial connection" print "3: Paralell connection" print "4: Close program" #Skripta izbornika. choice = raw_input() #Jedna dioda. if choice == "1": numberA = raw_input("Enter source voltage: ") numberB = raw_input("Enter diode voltage: ") numberC = raw_input("Enter diode current in ampers: ") numberE = float(1.6) print " " print single(numberA, numberB, numberC, numberE) print "\n" #Serijski spoj. elif choice == "2": numberA = raw_input("Enter source voltage: ") numberB = raw_input("Enter diode voltage: ") numberC = raw_input("Enter diode current in ampers: ") numberD = raw_input("Enter number of diodes: ") numberE = float(1.6) print " " print serial(numberA, numberB, numberC, numberD, numberE) print "\n" #Paralelan spoj. elif choice == "3": numberA = raw_input("Enter source voltage: ") numberB = raw_input("Enter diode voltage: ") numberC = raw_input("Enter diode current in ampers: ") numberD = raw_input("Enter number of diodes: ") numberE = float(1.6) print " " print parallel(numberA, numberB, numberC, numberD, numberE) print "\n" #Izlaz. elif choice == "4": print "Goodbye." keepProgramRunning = False #Za kretene. else: print "Please, choose one of the options given." print "\n" And only Iv000 and I will understand the description lines, unless someone else knows Croatian too. Link to comment Share on other sites More sharing options...
Iv000 Posted March 12, 2013 Share Posted March 12, 2013 I have too much penis to be a girl. :wink: I know guys with vaginas and girls with penises :teehee: My best friend is trans FtM actually and more manly than 97% of the guys I know xDOh genetics, u so funny. In other news, I just finished the script. :dance: Since I'm still inexperienced in Python, I call a definition that requires "return" value while I use a "print" value for the end result. Works like a charm but it shows "None" at the end of the result, not a big deal for me. Also reduced it down to 106 lines, removed some junk and worthless descriptions I used while I wrote it. Here's the script, it's the first portable LED resistor calculator I've seen so far, and I've been looking for one in quite a while: I was impressed by that code :D though I guess since you finished engineering or something I shouldn't be surprised. and also #Za kretene. else: print "Please, choose one of the options given." print "\n" Didn't expect that and made me lol ;D Link to comment Share on other sites More sharing options...
K00L Posted March 12, 2013 Share Posted March 12, 2013 :mellow: Link to comment Share on other sites More sharing options...
Iv000 Posted March 12, 2013 Share Posted March 12, 2013 Not very creative of you, K00L.It could have been a smiley face at least, why mellow ;-; Link to comment Share on other sites More sharing options...
Werne Posted March 12, 2013 Share Posted March 12, 2013 I was impressed by that code :biggrin: though I guess since you finished engineering or something I shouldn't be surprised.Electro-mechanical engineering, finished it with second highest grades in my class. :cool: People and my IQ tests say I'm smart. Clinically insane, but smart. :happy: #Za kretene. else: print "Please, choose one of the options given." print "\n"Didn't expect that and made me lol ;DThat is an acceptable and accurate description of that part of the script. :yes: If a man has four choices, he can't choose the fifth. If he does that, I described him correctly. :biggrin: Link to comment Share on other sites More sharing options...
Iv000 Posted March 12, 2013 Share Posted March 12, 2013 People and my IQ tests say I'm smart. Clinically insane, but smart. :happy: The biggest geniuses in history were insane to an extent.We're on the right path :laugh: insane now, world domination tomorrow :P Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now