Difference between revisions of "Tutorials/Using Fischertechnik Sensors with the VEX Cortex"

From ROBOTC API Guide
Jump to: navigation, search
(Created page with "{{DISPLAYTITLE:{{SUBPAGENAME}}}} <yambe:breadcrumb self="VEX Speaker module">Tutorials|Tutorials</yambe:breadcrumb> <br /> {| width="740px" |- |[[Image:fischertechnik_1.jpg|l...")
 
Line 6: Line 6:
 
|-
 
|-
 
|[[Image:fischertechnik_1.jpg|left|thumb|VEX Speaker]]
 
|[[Image:fischertechnik_1.jpg|left|thumb|VEX Speaker]]
|style="vertical-align: top;"|Got a new VEX Speaker?
+
|style="vertical-align: top;"|The VEX Cortex is an incredibly powerful and versatile microcontroller. Part of what makes it so versatile is the basic 3-pin system (Power, Signal, Ground) it uses for inputs and outputs.
  
 +
When coupled with a powerful programming language like ROBOTC, the VEX Cortex allows you to connect all types of third-party sensors (and actuators) with little or no effort. Taken from the [http://www.vexforum.com/wiki/index.php/VEX_Cortex_Microcontroller VEX Wiki], any analog sensor can be connected to the Cortex as long as its characteristics align with the following:
 +
- Output voltage range: 0.0 v to 5.0 v.
 +
- Must not exceed -0.5v to +5.5v.
  
VEX Robotics just announced (and released) their new Speaker accessory for the VEX Cortex Microcontroller. This cool new speaker will allow you to play tones, sounds and wave (.wav) sound files from your VEX Cortex. The new speaker plugs into the “SP” port on the Cortex – check near the bottom of the sensor bank of ports. The speaker even has a built in volume control:
+
Likewise, any digital sensor can be directly connected to the Cortex as long as its characteristics align with the following:
 +
- Provides 0.0 to 0.6 volts for a low and 2.5 to 5.0 volts for a high.
 +
- Must not exceed -0.5v or +5.5v.
  
 +
All of the basic Fischertechnik sensors meet these qualifying characteristics, making them perfect candidates for use with the VEX Cortex!
  
Check out our cool unboxing photos below, exclusive from the VEX World Championships!
+
'''Analog Sensors Example: Fischertechnic Photoresistor'''
  
 
+
Based on the [http://www.education.rec.ri.cmu.edu/products/teaching_robotc_cortex/reference/cortex_schematic.pdf VEX Cortex Schematic], the SIGNAL line in the ANALOG INPUTS bank is closest to the USB Port in the center of the Cortex, with the +5 VOLTS line next, and finally the GROUND line. The Fischertechnic analog sensors only have two output pins, and we’ll be connecting them to the SIGNAL and +5V lines.
The awesome thing with this new speaker accessory is that ROBOTC already has support for this new speaker built into version 3.08! For more information on how to use the speaker, check the ROBOTC help documentation built into ROBOTC, or look at our new (under construction) ROBOTC code wiki!
+
|-
 
+
|
Wiki Link: [[VEX2_Functions_Sound]]
+
 
+
To help you get started, here are two sample programs to try out your new VEX speaker attachment.
+
 
|}
 
|}
 
<br />
 
<br />
  
== Unboxing ==
 
<gallery>
 
File:Tut-vex-box-1.jpg|VEX Speaker Unboxing
 
File:Tut-vex-box-2.jpg|VEX Speaker Unboxing
 
File:Tut-vex-box-3.jpg|VEX Speaker Unboxing
 
File:Tut-vex-speaker.jpg|Attached to Cortex
 
</gallery>
 
<br />
 
  
 
== Example Code ==
 
== Example Code ==
Line 59: Line 54:
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
<br />
 
 
== Sample Program Downloads ==
 
*[[File:VEX Songs.c]]
 
*[[File:Sound Test.c]]
 
<br />
 
 
== PowerPoint explaining VEX Speaker ==
 
*[[File:VEX-Sounds.pptx]]
 
<br />
 
 
== Sound Files ==
 
*[[File:Numbers.zip]]
 
*[[File:Alphabet.zip]]
 
 
<br />
 
<br />

Revision as of 15:08, 7 May 2012

Tutorials → VEX Speaker module


VEX Speaker
The VEX Cortex is an incredibly powerful and versatile microcontroller. Part of what makes it so versatile is the basic 3-pin system (Power, Signal, Ground) it uses for inputs and outputs.

When coupled with a powerful programming language like ROBOTC, the VEX Cortex allows you to connect all types of third-party sensors (and actuators) with little or no effort. Taken from the VEX Wiki, any analog sensor can be connected to the Cortex as long as its characteristics align with the following: - Output voltage range: 0.0 v to 5.0 v. - Must not exceed -0.5v to +5.5v.

Likewise, any digital sensor can be directly connected to the Cortex as long as its characteristics align with the following: - Provides 0.0 to 0.6 volts for a low and 2.5 to 5.0 volts for a high. - Must not exceed -0.5v or +5.5v.

All of the basic Fischertechnik sensors meet these qualifying characteristics, making them perfect candidates for use with the VEX Cortex!

Analog Sensors Example: Fischertechnic Photoresistor

Based on the VEX Cortex Schematic, the SIGNAL line in the ANALOG INPUTS bank is closest to the USB Port in the center of the Cortex, with the +5 VOLTS line next, and finally the GROUND line. The Fischertechnic analog sensors only have two output pins, and we’ll be connecting them to the SIGNAL and +5V lines.



Example Code

Sound Test:

task main()
{
  //Basic "Play Sound" commands
  PlaySound(soundBeepBeep);
  wait1Msec(200);
 
  //Intelligent "Play Sound" command
  //Delay until sound is done playing
  PlaySound(soundFastUpwardTones);
  while(bSoundActive)
  wait1Msec(1);
 
  //Play a tone:
  //First Parameter: Frequence in Hz
  //Second Parameter: Length to play in 1/100th of a seconds (50 = .5 seconds)
  PlayTone(440, 50);
  wait1Msec(500);
 
  //Play a Sound File (need to use the File Management to Upload First)
  PlaySoundFile("1.wav");
  wait1Msec(1000);
}