<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.robotc.net/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.robotc.net/w/index.php?title=Using_define&amp;feed=atom&amp;action=history</id>
		<title>Using define - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.robotc.net/w/index.php?title=Using_define&amp;feed=atom&amp;action=history"/>
		<link rel="alternate" type="text/html" href="http://www.robotc.net/w/index.php?title=Using_define&amp;action=history"/>
		<updated>2013-05-18T19:32:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.18.0</generator>

	<entry>
		<id>http://www.robotc.net/w/index.php?title=Using_define&amp;diff=3471&amp;oldid=prev</id>
		<title>Bfeher at 21:23, 15 May 2012</title>
		<link rel="alternate" type="text/html" href="http://www.robotc.net/w/index.php?title=Using_define&amp;diff=3471&amp;oldid=prev"/>
				<updated>2012-05-15T21:23:17Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 21:23, 15 May 2012&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE: Using &amp;amp;#35;define}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE: Using &amp;amp;#35;define}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;yambe:breadcrumb self=&amp;quot;Using &amp;amp;#35;define&amp;gt;Programming_Tips_Tricks|Programming Tips Tricks&amp;lt;/yambe:breadcrumb&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;yambe:breadcrumb self=&amp;quot;Using &amp;amp;#35;define&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;quot;&lt;/ins&gt;&amp;gt;Programming_Tips_Tricks|Programming Tips Tricks&amp;lt;/yambe:breadcrumb&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bfeher</name></author>	</entry>

	<entry>
		<id>http://www.robotc.net/w/index.php?title=Using_define&amp;diff=3462&amp;oldid=prev</id>
		<title>Bfeher at 20:56, 15 May 2012</title>
		<link rel="alternate" type="text/html" href="http://www.robotc.net/w/index.php?title=Using_define&amp;diff=3462&amp;oldid=prev"/>
				<updated>2012-05-15T20:56:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 20:56, 15 May 2012&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE: Using #define}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{{DISPLAYTITLE: Using &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;&lt;/ins&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;35;&lt;/ins&gt;define}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;yambe:breadcrumb self=&amp;quot;Using #define&amp;gt;Programming_Tips_Tricks|Programming Tips Tricks&amp;lt;/yambe:breadcrumb&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;yambe:breadcrumb self=&amp;quot;Using &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;&amp;amp;&lt;/ins&gt;#&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;35;&lt;/ins&gt;define&amp;gt;Programming_Tips_Tricks|Programming Tips Tricks&amp;lt;/yambe:breadcrumb&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Bfeher</name></author>	</entry>

	<entry>
		<id>http://www.robotc.net/w/index.php?title=Using_define&amp;diff=3461&amp;oldid=prev</id>
		<title>Bfeher: Created page with &quot;{{DISPLAYTITLE: Using #define}} &lt;yambe:breadcrumb self=&quot;Using #define&gt;Programming_Tips_Tricks|Programming Tips Tricks&lt;/yambe:breadcrumb&gt; &lt;br /&gt;  Some of the uses for the #defi...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.robotc.net/w/index.php?title=Using_define&amp;diff=3461&amp;oldid=prev"/>
				<updated>2012-05-15T20:52:06Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{DISPLAYTITLE: Using #define}} &amp;lt;yambe:breadcrumb self=&amp;quot;Using #define&amp;gt;Programming_Tips_Tricks|Programming Tips Tricks&amp;lt;/yambe:breadcrumb&amp;gt; &amp;lt;br /&amp;gt;  Some of the uses for the #defi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{DISPLAYTITLE: Using #define}}&lt;br /&gt;
&amp;lt;yambe:breadcrumb self=&amp;quot;Using #define&amp;gt;Programming_Tips_Tricks|Programming Tips Tricks&amp;lt;/yambe:breadcrumb&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Some of the uses for the #define statement, not all necessarily good programming but it shows that it has other uses beyond just defining constants. More explanation here http://en.wikipedia.org/wiki/C_preprocessor&amp;lt;br /&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;syntaxhighlight lang=&amp;quot;ROBOTC&amp;quot;&amp;gt;&lt;br /&gt;
#pragma config(UART_Usage, UART1, VEX_2x16_LCD, baudRate19200, IOPins, None, None)&lt;br /&gt;
#pragma config(Motor,  port1,           ,              tmotorNormal, openLoop)&lt;br /&gt;
#pragma config(Motor,  port2,           ,              tmotorNormal, openLoop)&lt;br /&gt;
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//&lt;br /&gt;
&lt;br /&gt;
#define DEBUG&lt;br /&gt;
&lt;br /&gt;
#define ABS(x)          ( (x)&amp;gt;=0?(x):-(x) )&lt;br /&gt;
&lt;br /&gt;
#define DRIVE_MOTOR(x)  do{\&lt;br /&gt;
                        motor[port1] = (x);\&lt;br /&gt;
                        motor[port2] = (x);\&lt;br /&gt;
                        }while(0)&lt;br /&gt;
&lt;br /&gt;
#define JOY_DRIVE       vexJSLeftV&lt;br /&gt;
&lt;br /&gt;
#define DISPLAY_MOTORS  do{\&lt;br /&gt;
                        displayLCDNumber(1, 0, motor[port1], 3);\&lt;br /&gt;
                        displayLCDNumber(1, 8, motor[port2], 3);\&lt;br /&gt;
                        }while(0)&lt;br /&gt;
&lt;br /&gt;
task main()&lt;br /&gt;
{&lt;br /&gt;
    while(true)&lt;br /&gt;
      {&lt;br /&gt;
      DRIVE_MOTOR( vexRT[ JOY_DRIVE ] ); &lt;br /&gt;
      wait1Msec(20);&lt;br /&gt;
&lt;br /&gt;
#ifdef  DEBUG&lt;br /&gt;
      DISPLAY_MOTORS;&lt;br /&gt;
#endif      &lt;br /&gt;
      }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{tip-from-author&lt;br /&gt;
|name=jpearman&lt;br /&gt;
|link=http://www.vexforum.com/showpost.php?p=224863&amp;amp;postcount=12&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Bfeher</name></author>	</entry>

	</feed>