Skip to content

Instantly share code, notes, and snippets.

@gregwinn
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregwinn/6dcdde3ecd0011518ff4 to your computer and use it in GitHub Desktop.
Save gregwinn/6dcdde3ecd0011518ff4 to your computer and use it in GitHub Desktop.
Using this TI BASIC program, it will calculate the value resistor needed for an LED (for use with less then 1 Amp). TI Nspire CX CAS
# Used on a TI Nspire CX CAS
# --------------------------
# "Remove comments before running"
Define ledresistorval()=
Prgm
Request "VCC",v1
Request "Forward Voltage",v2
Request "Forward Current",c
If v1<v2 Then
Return "LED value too low"
EndIf
If v1=v2 Then
Return "Error"
EndIf
If c>1 Then
Return "Current too high."
EndIf
Disp "Resistor Value: "
Disp ((v1-v2)/(c))
Return
EndPrgm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment