User Tools

Site Tools


nxt_sensor-in_digital-out_microphone_and_leds

Differences

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

Link to this comparison view

nxt_sensor-in_digital-out_microphone_and_leds [2016/11/01 15:43] – created dwallacenxt_sensor-in_digital-out_microphone_and_leds [2016/11/09 13:43] (current) dwallace
Line 1: Line 1:
 ====== NXT Sensor-In/Digital-Out (Microphone and LEDs) ====== ====== NXT Sensor-In/Digital-Out (Microphone and LEDs) ======
  
-==Wiring== +==== Wiring ===== 
-'''NOTE:''' ''This is the same setup as the last exercise "Potentiometer and LEDs". The potentiometer is no longer necessary to the circuit but can remain in place without interference.''+**NOTE:** This is the same setup as the last exercise "Potentiometer and LEDs". The potentiometer is no longer necessary to the circuit but can remain in place without interference.
  
 Plug the NXT sound sensor (microphone) into sensor port 2 0n the NXT. Plug the NXT sound sensor (microphone) into sensor port 2 0n the NXT.
  
-{|style=" border-collapse: separate; border-spacing: 15; border-width: 0px; border-style: solid; border-color: #FFFFFF; padding: 0px; text-align: center;" +  * 220 Ohm Resistor (6) 
-|- + 
-!style="width: 75px; background: #F0F0F0"| Part +  10k Potentiometer (1) 
-!style="width: 100px; background: #F0F0F0"| Quantity + 
-|- +  LED (6) 
-220 Ohm Resistor +
-+
-|- +
-10k Potentiometer +
-+
-|- +
-LED +
-+
-|} +
-<br>+
 The six LEDs are connected to six digital-out pins. As the volume varies between 0% and 100% of the sensor's range, it outputs a value between 0 and 100. This value is read in the same algorithm as analog input A0 was read before and the amount of lit LEDs corresponds to the output of the sensor. The six LEDs are connected to six digital-out pins. As the volume varies between 0% and 100% of the sensor's range, it outputs a value between 0 and 100. This value is read in the same algorithm as analog input A0 was read before and the amount of lit LEDs corresponds to the output of the sensor.
-This digital-out pin control can be realized in the code excerpt below:<br><br>+This digital-out pin control can be realized in the code excerpt below:
  
-<source lang="c" line start="92">+<code c>
 ... ...
  if(inputdata>20)  outputdata=b0|b1;  if(inputdata>20)  outputdata=b0|b1;
Line 32: Line 23:
  if(inputdata>90)  outputdata=b0|b1|b2|b3|b4|b5;  if(inputdata>90)  outputdata=b0|b1|b2|b3|b4|b5;
 ... ...
-</source>+</code> 
 + 
 +{{PotLEDdiagram.jpg}}\\  
 +Circuit Diagram from HiTechnic's Experimenter's Kit Handbook\\  
 + 
 +{{PotCircuitPhoto.jpg}}\\  
 +Photo of completed circuit\\  
 + 
 +===== Video ===== 
  
-<br><br> 
  
-{| style="text-aligncenter; margin: 1em auto 1em auto;" +**Note:** If the video doesn't work just reload the page.
-|  +
-{|  +
-| 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== +===== NXC Code =====
-<html> +
-<iframe width="853" height="480" src="http://www.youtube.com/embed/ZHz3jrvTSUE" frameborder="0" allowfullscreen></iframe> +
-</html> +
-<br>'''Note:''' If the video doesn't work just reload the page.+
  
-==NXC Code== +<code MicLED.nxc>
-<source lang="c" line start="1">+
 /* /*
 Filename: MicLED.nxc Filename: MicLED.nxc
Line 161: Line 144:
     StopAllTasks();     StopAllTasks();
 } }
-</source>+</code> 
 + 
 +===== Download =====
  
-===Download=== +{{MicLED.zip}}
-[[File:MicLED.zip]]+
nxt_sensor-in_digital-out_microphone_and_leds.txt · Last modified: 2016/11/09 13:43 by dwallace