User Tools

Site Tools


analog-in_digital-out_potentiometer_and_leds

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
analog-in_digital-out_potentiometer_and_leds [2016/11/01 15:42] – created dwallaceanalog-in_digital-out_potentiometer_and_leds [2016/11/09 13:36] dwallace
Line 1: Line 1:
 ====== Analog-In/Digital-Out (Potentiometer and LEDs) ====== ====== Analog-In/Digital-Out (Potentiometer and LEDs) ======
  
-==Intro== +===== Intro =====
-HiTechnic's Prototype Board allows analog input and digital input and output to be easily achieved with a breadboard for circuit prototyping and a LEGO NXT from the Mindstorms robotics kit. This board connects to the standard NXT sensor port and communicates over an I2C serial bus.<br> +
-<br> +
-The files to accompany the HiTechnic Prototype Board (old version, not "SuperPro") can be found on [http://www.hitechnic.com/products HiTechnic'c Downloads page] or right here:<br> +
-[[File:HiTechnic_ExperimentersKitA.zip|HiTechnic_ExperimentersKitA.zip]] +
-<br> +
-The PDF handbook included in the file above can also be downloaded here:<br> +
-[[File:HiTechnicExperimentersKitHandbookA.pdf]]+
  
-==Wiring== +HiTechnic'Prototype Board allows analog input and digital input and output to be easily achieved with breadboard for circuit prototyping and a LEGO NXT from the Mindstorms robotics kitThis board connects to the standard NXT sensor port and communicates over an I2C serial bus.
-{|style=" border-collapse: separate; border-spacing: 15; border-width: 0px; border-style: solid; border-color: #FFFFFF; padding: 0px; text-align: center;" +
-|- +
-!style="width: 75px; background: #F0F0F0"| Part +
-!style="width: 100px; background: #F0F0F0"| Quantity +
-|- +
-| 220 Ohm Resistor +
-| 6 +
-|- +
-| 10k Potentiometer +
-| 1 +
-|- +
-| LED +
-| 6 +
-|} +
-<br> +
-The six LEDs are connected to six pins that will act as a digital out. The potentiometer'variable resistance causes a variable voltage to be read at the analog input AO. This voltage is read in as number between 0 and 1024. The LEDs are lit up linearly as the potentiometer is rotated.<br> +
-For example, when the pin A0 reads a voltage corresponding to 200 (~20%), the first LED will light upAt 400, 2 LEDS will light. At 1000 or greater, all LEDs will be lit. This digital-out pin control can be realized in the code excerpt below:<br><br>+
  
-<source lang="cline start="80">+The files to accompany the HiTechnic Prototype Board (old version, not "SuperPro") can be found on [[http://www.hitechnic.com/products|HiTechnic'c Downloads page]] or right here: 
 +{{file:HiTechnic_ExperimentersKitA.zip}} 
 + 
 +The PDF handbook included in the file above can also be downloaded here: 
 +{{file:HiTechnicExperimentersKitHandbookA.pdf}} 
 + 
 +===== Wiring ===== 
 + 
 + 
 +  * 220 Ohm Resistor (6) 
 + 
 +  * 10k Potentiometer (1) 
 + 
 +  * LED (6) 
 + 
 +The six LEDs are connected to six pins that will act as a digital out. The potentiometer's variable resistance causes a variable voltage to be read at the analog input AO. This voltage is read in as a number between 0 and 1024. The LEDs are lit up linearly as the potentiometer is rotated. 
 +For example, when the pin A0 reads a voltage corresponding to 200 (~20%), the first LED will light up. At 400, 2 LEDS will light. At 1000 or greater, all LEDs will be lit. This digital-out pin control can be realized in the code excerpt below: 
 + 
 +<code c>
 ... ...
  if(inputdata>200)  outputdata=b0|b1;  if(inputdata>200)  outputdata=b0|b1;
Line 37: Line 31:
  if(inputdata>1000) outputdata=b0|b1|b2|b3|b4|b5;  if(inputdata>1000) outputdata=b0|b1|b2|b3|b4|b5;
 ... ...
-</source>+</code> 
 + 
 +{{file:PotLEDdiagram.jpg}}\\  
 +Circuit Diagram from HiTechnic's Experimenter's Kit Handbook\\  
 + 
 +{{file:PotCircuitPhoto.jpg}}\\  
 +Photo of completed circuit\\  
 + 
 +===== Video ===== 
 + 
 +{{youtube>pIjAGGYgIfI?large}}\\ 
  
-<br><br>+**Note:** If the video doesn't work just reload the page.
  
-{| style="text-align: center; margin: 1em auto 1em auto;" +===== NXC Code =====
-|  +
-{|  +
-| style="border: 1px solid #CCCCCC;" valign="center" | <span id="PitchMount">[[Image:PotLEDdiagram.jpg|300px|Circuit Diagram from HiTechnic's Experimenter's Kit Handbook]]</span> +
-| style="width: 10px" |  +
-| style="border: 1px solid #CCCCCC;" valign="center" | <span id="PitchMotor">[[Image:PotCircuitPhoto.jpg|300px|Photo of completed circuit]]</span> +
-|- +
-| style="border: 1px solid #CCCCCC; background: #F9F9F9" | Circuit Diagram from HiTechnic's Experimenter's Kit Handbook +
-+
-| style="border: 1px solid #CCCCCC; background: #F9F9F9" | Photo of completed circuit: +
-|} +
-|} +
-==Video== +
-<html> +
-<iframe width="853" height="480" src="http://www.youtube.com/embed/pIjAGGYgIfI" frameborder="0" allowfullscreen></iframe> +
-</html> +
-<br> +
-'''Note:''' If the video doesn't work just reload the page.+
  
-==NXC Code== +<code c PotLED.c>
-<source lang="c" line start="1">+
 /*    /*   
 Filename: PotLED.nxc Filename: PotLED.nxc
Line 152: Line 138:
     }     }
 } }
-</source>+</code> 
 + 
 +===== Download =====
  
-===Download=== +{{file:PotLED.zip}}
-[[File:PotLED.zip]]+
analog-in_digital-out_potentiometer_and_leds.txt · Last modified: 2016/11/09 13:37 by dwallace