Code: Select all
PRINT "Note that car LED voltages may be as high as 14 volts due to charging!"
PRINT
DO
INPUT "Enter DC power supply or battery voltage to be used >= 1.5: ", volts
LOOP UNTIL volts >= 1.5
DO
INPUT "Enter the DC voltage required by the LED to light <= supply voltage: ", LEDV
LOOP UNTIL LEDV > 0 AND LEDV <= volts
IF LEDV = volts THEN
PRINT "No current limiting resistor is required!"
ELSE: Vdrop = volts - LEDV
PRINT "A resistor is required to drop "; Vdrop; "volts"
DO
INPUT "Enter LED current required to light the LED properly in milliamps: ", MA
LOOP UNTIL MA > 1 AND MA < 500
MA = MA / 1000
resistor& = Vdrop / MA
watts = (MA ^ 2) * resistor& * 1.5
PRINT "Resistor required is"; resistor&; "ohms at"; watts; "watts."
END IF
Code: Select all
'Inductive Reactance = 2*pi*frequency*inductance
'Capacitive Reactance = 1/(2*pi*frequency*capacitance)
DO
INPUT "Enter AC supply voltage: ", voltage& '= 120
LOOP UNTIL voltage& > 0
ACfreq = 60 ' 50 'in Europe and Asia?
DO
INPUT "Capacitor farads(1uf = .000001) or microfarads >= .001:"; capacity '= .000000068
LOOP UNTIL capacity > 0
IF capacity >= .001 THEN capacity = capacity / 1000000: PRINT USING ".############ farads"; capacity
Creact& = 1 / (8 * ATN(1) * ACfreq * capacity)
PRINT USING "Reactance = ########,.## ohms"; Creact&
current = voltage& / Creact&
PRINT USING "Supply Current = ##.###### amps"; current
Return to “General Discussion”
Users browsing this forum: Majestic-12 [Bot] and 5 guests