<?xml version="1.0"?><rss version="2.0">
<channel>
  <title>Alan&#039;s Ramblings</title>
  <link>http://bleaklow.com:80/</link>
  <description>My opinions may be incorrect, but they are my own</description>
  <language>en</language>
  <copyright>Alan Burlison</copyright>
  <lastBuildDate>Tue, 20 Jul 2010 18:07:00 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  <item>
    <title>A very simple Arduino task manager</title>
    <link>http://bleaklow.com:80/2010/07/20/a_very_simple_arduino_task_manager.html</link>
    <description>
          &lt;p&gt;
The LED chain project I&#039;m working on requires that the AVR microcontroller handles several different tasks:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Read a rotary encoder and switch&lt;/li&gt;
&lt;li&gt;Drive a seven-segment display&lt;/li&gt;
&lt;li&gt;Drive a radio&lt;/li&gt;
&lt;li&gt;Drive four LED strips each containing twenty LEDs&lt;/li&gt;
&lt;li&gt;Provide logic to tie all the above together&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Normally that sort of multiple-task workload might suggest the use of a &lt;a href=&#034;http://en.wikipedia.org/wiki/Real-time_operating_system&#034;&gt;RTOS&lt;/a&gt;, but the &lt;a href=&#034;http://www.arduino.cc/en/Main/ArduinoBoardProMini&#034;&gt;Arduino Pro Mini&lt;/a&gt; has only 16Kb of program memory (of which 2Kb is used by the bootloader) and 1Kb of RAM, so every byte is precious. So, whatever we come up with has to be as minimal as possible.  OK, let&#039;s see if we can make some assumptions and trade-offs that will help keep things simple and create a small set of C++ classes we can use to implement the task management we need:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use cooperative multitasking rather than preemptive multitasking.  Out of that fall a couple of constraints:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Each task must complete quickly when it runs.  Long-running operations such as &lt;code&gt;&lt;a href=&#034;http://www.arduino.cc/en/Reference/Delay&#034;&gt;delay()&lt;/a&gt;&lt;/code&gt; are forbidden.&lt;/li&gt;
&lt;li&gt;Any interrupt service routines must also complete quickly, preferably by recording the details of the event and scheduling a task to handle it.&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;The task management system should not require the use of dynamic memory management (e.g. &lt;code&gt;malloc()&lt;/code&gt;) so as to minimise memory requirements.&lt;/li&gt;
&lt;li&gt;The list of tasks will be fixed at compile-time.  That&#039;s reasonable as the configuration of the system is fixed - we aren&#039;t going to be adding new hardware on the fly.&lt;/li&gt;
&lt;li&gt;Tasks will be scheduled in priority order to allow processing that has strict time constraints to be handled first, but to keep things simple the priority order will be fixed at compile time.  Again, that&#039;s reasonable as the configuration of the system is known in advance.&lt;/li&gt;
&lt;li&gt;Tasks can communicate with each other by making standard C++ method calls but (as for interrupts) any such methods should simply store the details of the event and schedule themselves to be run to handle the event.
&lt;li&gt;Much of the processing we are doing is time-driven, e.g. sequencing the LED patterns, so explicit support for scheduling tasks at specific intervals should be provided, as well as more general &#039;triggered&#039; tasks.
&lt;/ul&gt;
&lt;p&gt;
The last constraint needs some further thought - what timer &#039;tick&#039; interval should we use?  The &#039;real world&#039; events we will be dealing with won&#039;t be happening quicker that 1 millisecond apart and the CPU is clocked at 16MHz which equates to 16000 instructions per millisecond.  Scheduling time-based tasks at millisecond resolution will allow us to run several tasks within the same &#039;tick and will be more than fast enough to deal with the events we have to handle.&lt;/p&gt;
&lt;p&gt;
OK, so given all that, what would a suitable task implementation look like?
&lt;/p&gt;
&lt;pre&gt;
class Task {
public:
    virtual bool canRun(uint32_t now) = 0;
    virtual void run(uint32_t now) = 0;
};

class TimedTask : public Task {
public:
    inline TimedTask(uint32_t when) { runTime = when; }
    virtual bool canRun(uint32_t now);
    inline void setRunTime(uint32_t when) { runTime = when; }
protected:
    uint32_t runTime;
};

bool TimedTask::canRun(uint32_t now) {
    return now &gt;= runTime;
}
&lt;/pre&gt;
&lt;p&gt;
Yep, that&#039;s really all there is to it.  Each task can be queried to see if it can be run via the &lt;code&gt;canRun()&lt;/code&gt;, method and if it can, it will be executed via a call to its &lt;code&gt;run()&lt;/code&gt; method.  We pass in the current time in milliseconds to avoid each task having to separately determine it.  The &lt;code&gt;canRun()&lt;/code&gt; and &lt;code&gt;run()&lt;/code&gt; methods &lt;i&gt;could&lt;/i&gt; be merged, but having them separate allows us to provide more flexible scheduling if we ever need to, e.g. by penalising tasks that are runnable too often.
&lt;/p&gt;
&lt;p&gt;
OK, next step is to implement the actual task scheduler:
&lt;/p&gt;
&lt;pre&gt;
class TaskScheduler {
public:
    TaskScheduler(Task **task, uint8_t numTasks);
    void run();
private:
    Task **tasks;
    int numTasks;
};

TaskScheduler::TaskScheduler(Task **_tasks, uint8_t _numTasks) :
  tasks(_tasks),
  numTasks(_numTasks) {
}

void TaskScheduler::run() {
    while (1) {
        uint32_t now = millis();
        Task **tpp = tasks;
        for (int t = 0; t &lt; numTasks; t++) {
            Task *tp = *tpp;
            if (tp-&gt;canRun(now)) {
                tp-&gt;run(now);
                break;
            }
            tpp++;
        }
    }
}
&lt;/pre&gt;
&lt;p&gt;
Again, that really is all there is to it.  We create the task scheduler with a fixed list of tasks, then call its run method.  The run method iterates endlessly over the task list, calling the &lt;code&gt;canRun()&lt;/code&gt; method on each in turn to see if it needs to be run.  If it does, its &lt;code&gt;run()&lt;/code&gt; method is called to execute the task.  One very important note: after running a task we break out of the iteration over the task list and start back at the top of the list.  That gives us the fixed task priority feature - if multiple tasks are runnable the earlier tasks on the list will always be dispatched first and the later tasks on the list will be lower priority,
&lt;/p&gt;
&lt;p&gt;
The last part is to show an example of how to actually use the scheduler.  Each task is derived from either the base &lt;code&gt;Task&lt;/code&gt; class or from &lt;code&gt;TimedTask&lt;/code&gt;, depending on how it needs to be run.  Then in the main body of the program we create a list of tasks, pass it to a &lt;code&gt;TaskScheduler&lt;/code&gt; instance and then run the scheduler:
&lt;/p&gt;
&lt;pre&gt;
Display display();
Sequencer sequencer();
RotaryEncoder encoder();
Task *tasks[] = { &amp;encoder, &amp;sequencer, &amp;display };
TaskScheduler sched(tasks, 3);
sched.run();
&lt;/pre&gt;
&lt;p&gt;
That&#039;s all there is to it.  With this approach it&#039;s possible to provide a lightweight set of communicating tasks that are scheduled in priority order.  The code is both high performance and lightweight, two vital attributes considering the constrained environment it must operate in.  Providing the various &lt;code&gt;run()&lt;/code&gt; methods are reasonably short, it will run tasks within less than one millisecond of when they are scheduled, which is perfectly adequate for our needs - I&#039;ll give an example of using this library to perform a timing-critical process (switch de-bouncing) in a later post.
&lt;/p&gt;
&lt;p&gt;
It&#039;s simple enough to implement your own variant, but if you want the code it&#039;s available &lt;a href=&#034;/files/2010/Task.tar.gz&#034;&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;h2&gt;Acknowledgement&lt;/h2&gt;
&lt;p&gt;
I&#039;d like to acknowledge my MSc tutor &lt;a href=&#034;http://www.lboro.ac.uk/departments/co/people/acad_staff/machin.html&#034;&gt;Dr. Colin Machin&lt;/a&gt; who sat down with me one afternoon back in 1984 and outlined this approach to me, which I then used for the Z80 robot controller that was the subject of my MSc thesis.  He&#039;d used used the same technique for a LIDAR data acquisition system he&#039;d written to collect data on the wingtip vortices caused by commercial aircraft as they land. Good ideas always stand the test of time - thanks Colin :-)
&lt;/p&gt;</description>
      <category>Arduino</category>
    <category>Tech</category>
    <comments>http://bleaklow.com:80/2010/07/20/a_very_simple_arduino_task_manager.html#comments</comments>
    <guid isPermaLink="true">http://bleaklow.com:80/2010/07/20/a_very_simple_arduino_task_manager.html</guid>
    <pubDate>Tue, 20 Jul 2010 18:07:00 GMT</pubDate>
  </item>
  <item>
    <title>It&#039;s a secret</title>
    <link>http://bleaklow.com:80/2010/07/03/its_a_secret.html</link>
    <description>
          &lt;p&gt;
Went for a walk with the family yesterday evening after tea and took the following picture with the less than excellent camera on my phone but I rather like the soft effect.  The location is less than 6 miles in a straight line from the house, and less than 200 metres from the nearest road, but I&#039;m not telling you exactly where it is - it&#039;s a secret :-)
&lt;/p&gt;
&lt;p&gt;
&lt;img style=&#034;display: block; margin: auto;&#034; src=&#034;images/2010/secret_waterfall.jpeg&#034; alt=&#034;Secret waterfall&#034;&gt;
&lt;/p&gt;</description>
      <category>Family</category>
    <category>Peak District</category>
    <category>Personal</category>
    <comments>http://bleaklow.com:80/2010/07/03/its_a_secret.html#comments</comments>
    <guid isPermaLink="true">http://bleaklow.com:80/2010/07/03/its_a_secret.html</guid>
    <pubDate>Sat, 03 Jul 2010 21:51:00 GMT</pubDate>
  </item>
  <item>
    <title>Characterising the 7805</title>
    <link>http://bleaklow.com:80/2010/06/30/characterising_the_7805.html</link>
    <description>
          &lt;p&gt;
As the LED strips are going to be mobile, I needed to find a way of powering them.  After some investigation, the 7.2 volt NiMH battery packs used by radio controlled cars seemed like a good choice - they are high capacity, relatively cheap and readily available.  Although the &lt;a href=&#034;http://www.arduino.cc/en/Main/ArduinoBoardProMini&#034;&gt;Arduino Pro Mini&lt;/a&gt; has an on-board regulator, the HL1606 strips don&#039;t and according to the &lt;a href=&#034;http://led-headband.googlecode.com/files/nps6B3.pdf&#034;&gt;datasheet&lt;/a&gt; they need between 3V and 5.5V, with 5V being the preferred voltage.  That meant dropping the 7.2V from the batteries down to 5V.  The obvious first choice was the venerable (and cheap) 7805, specifically the 2A version - &lt;a href=&#034;http://www.st.com/stonline/products/literature/ds/2148/l78s09c.pdf&#034;&gt;STElectronics L78S05CV&lt;/a&gt;.  I&#039;d need 2 regs for each LED set to give the required 4A.  The regs are £0.62 from &lt;a href=&#034;http://www.bitsbox.co.uk&#034;&gt;BitsBox&lt;/a&gt;, with heatsinks and the recommended caps the total cost was about £3.00 per LED set.  There was only one problem though, the 7805 datasheet says the minimum input voltage is 8V, the batteries only output 7.2, so it seemed they wouldn&#039;t work.
&lt;/p&gt;
&lt;p&gt;
The next option was a &lt;a href=&#034;http://en.wikipedia.org/wiki/Low-dropout_regulator&#034;&gt;LDO&lt;/a&gt; regulator such as the &lt;a href=&#034;http://www.national.com/mpf/LM/LM2940.html&#034;&gt;LM2940&lt;/a&gt; but although they have a dropout voltage of only 0.5V, they are only rated at 1A and are £1.44 each, which would mean that the parts for each LED set would be over £9.00 - ouch.  Other options included a homebrew switching regulator such as &lt;a href=&#034;http://www.aca-vogel.de/DCDC-Converter/8AfromLM2575_en.html&#034;&gt;this one&lt;/a&gt; - not ideal because of the increased build and testing time, or a off-the-shelf switching regulator such as the &lt;a href=&#034;http://focus.ti.com/docs/prod/folders/print/pth08t231w.html&#034;&gt;PTH08T231W&lt;/a&gt; - again, not ideal because of cost - £11.00 each, plus £12.00 delivery from &lt;a href=&#034;http://gb.mouser.com&#034;&gt;Mouser&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Bearing in mind this project is cost-constrained, none of the alternatives to the 7805 really looked viable.  I decided to buy a couple of 7805s and see if they would actually work, despite what the datasheet said.  What I needed to do was to use a 7805 to power my 2-strip prototype with a range of different input voltages, and that required something I didn&#039;t have, a variable output bench power supply - and at about £100, it wasn&#039;t something I was going to rush out and buy.  Bob from &lt;a href=&#034;http://hacman.org.uk/&#034;&gt;Hacman&lt;/a&gt; pointed me in the direction of &lt;a href=&#034;http://www.fablabmanchester.org/&#034;&gt;FabLab&lt;/a&gt;, and an email confirmed that they had a suitable bench power supply.  As an aside, FabLab is a wonderful (and free!) resource that has all sorts of toys such as a laser cutter, a milling machine, a 3D printer and a CNC router - highly recommended!
&lt;/p&gt;
&lt;p&gt;
The first test measured max/min output voltage against input voltage, using my standard test pattern set.  The graph is below:
&lt;/p&gt;
&lt;img style=&#034;display: block; margin: auto;&#034; src=&#034;images/2010/7805V.png&#034; alt=&#034;7805&#034;&gt;
&lt;p&gt;
Things of note:
&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Vout never got above 4.85V.  That&#039;s obviously less than 5V, but still within the spec for the 7805, which is 4.8V to 5.2V.  I compared a couple of regs, they were all much the same.&lt;/li&gt;
&lt;li&gt;As Vin drops, Vout and quality of the regulation also drops. At Vin of 5.5V Vout swings by about 0.6V.&lt;/li&gt;
&lt;li&gt;Above Vin of 7V the load-induced Vout swing is around 0.1V.&lt;/li&gt;
&lt;li&gt;Below Vout of around 5.5V the operation of the strips became unstable.  The &lt;a href=&#034;http://led-headband.googlecode.com/files/nps6B3.pdf&#034;&gt;datasheet&lt;/a&gt; says they will work down to 3V, but like much of the information in there, it&#039;s incorrect.&lt;/li&gt;
&lt;li&gt;There was little perceived change in LED brightness across the usable voltage range.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
The second test measured input and output current against input voltage, with all 20 LEDs turned fully on (R+G+B on 100%), representing the maximum load the LED strips can generate.  The graph is below:
&lt;/p&gt;
&lt;img style=&#034;display: block; margin: auto;&#034; src=&#034;images/2010/7805A.png&#034; alt=&#034;7805&#034;&gt;
&lt;p&gt;
Things of note:
&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Maximum load was at 7.2V and above, with Ain of 1.7A and Aout of 1.67A.&lt;/li&gt;
&lt;li&gt;Below Vin of 7.2V Ain &amp;amp; Aout dropped fairly linearly with Vin.&lt;/li&gt;
&lt;li&gt;Below Vin of 6V the LED strips became unstable.&lt;/li&gt;
&lt;li&gt;The heatsink on the 7805 got &lt;strong&gt;very&lt;/strong&gt; hot with voltages above 7V, increasing as the Vin increased.  That&#039;s expected as the 7805 is a linear regulator and it dissipates the difference between Vin and Vout as heat, but a heatsink is absolutely necessary.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Much to my surprise, it appears that the 7805 will be OK for my application.  The &lt;a href=&#034;http://access.time.angelfire.com/battery_test_data_01.html&#034;&gt;information&lt;/a&gt; I&#039;ve found for NiMH battery performance suggests they have a flat output voltage of around 1.1V per cell until around 80% discharge, at which point the output voltage drops rapidly,  That means I&#039;ll be getting about 6.6V from each pack, which whilst not ideal is certainly workable.  The best solution would be a switched mode regulator, but as cost is a major constraint for this project, that isn&#039;t really an option.
&lt;/p&gt;</description>
      <category>Arduino</category>
    <category>Tech</category>
    <comments>http://bleaklow.com:80/2010/06/30/characterising_the_7805.html#comments</comments>
    <guid isPermaLink="true">http://bleaklow.com:80/2010/06/30/characterising_the_7805.html</guid>
    <pubDate>Wed, 30 Jun 2010 16:54:00 GMT</pubDate>
  </item>
  <item>
    <title>Manchester Day</title>
    <link>http://bleaklow.com:80/2010/06/22/manchester_day.html</link>
    <description>
          &lt;img src=&#034;http://farm5.static.flickr.com/4025/4718157319_e3b06d1812.jpg&#034; alt=&#034;Juba do Leao&#034;&gt;
&lt;p&gt;
On Sunday &lt;a href=&#034;http://www.jubadoleao.com/jdl/&#034;&gt;we&lt;/a&gt; played in the &lt;a href=&#034;http://www.themanchesterdayparade.co.uk/&#034;&gt;Manchester Day&lt;/a&gt; parade.  Seemingly about 75,000 people watched, so it&#039;s probably our biggest audience yet.  There are &lt;a href=&#034;http://www.flickr.com/photos/jeremykerr/4719528976&#034;&gt;loads&lt;/a&gt; &lt;a href=&#034;http://www.flickr.com/photos/37940944@N03/4724025682/&#034;&gt;of&lt;/a&gt; &lt;a href=&#034;http://www.flickr.com/photos/devilfishmark/4723805400/&#034;&gt;pictures&lt;/a&gt; &lt;a href=&#034;http://www.flickr.com/photos/24365773@N03/4722269954/&#034;&gt;of&lt;/a&gt; &lt;a href=&#034;http://www.flickr.com/photos/jeremykerr/4719534956/&#034;&gt;us&lt;/a&gt; &lt;a href=&#034;http://www.flickr.com/photos/jeremykerr/4720100532/&#034;&gt;on&lt;/a&gt; &lt;a href=&#034;http://www.flickr.com/photos/joshuakaitlyn/4724093782/&#034;&gt;flickr&lt;/a&gt;, and the costumes looked fab so all the work was worthwhile.  My only gripe is it wasn&#039;t really a traditional Manchester parade as it didn&#039;t rain :-)
&lt;/p&gt;</description>
      <category>Drumming</category>
    <category>Juba do Leao</category>
    <comments>http://bleaklow.com:80/2010/06/22/manchester_day.html#comments</comments>
    <guid isPermaLink="true">http://bleaklow.com:80/2010/06/22/manchester_day.html</guid>
    <pubDate>Tue, 22 Jun 2010 19:38:00 GMT</pubDate>
  </item>
  <item>
    <title>Configuring NetBeans to use as an Arduino IDE</title>
    <link>http://bleaklow.com:80/2010/06/22/configuring_netbeans_to_use_as_an_arduino_ide.html</link>
    <description>
          As I&#039;ve said in an earlier post, I very quickly found the &lt;a href=&#034;http://www.arduino.cc/en/Guide/Environment&#034;&gt;Arduino IDE&lt;/a&gt; to be way too primitive for serious use, so I decided to switch to using &lt;a href=&#034;http://netbeans.org/&#034;&gt;NetBeans&lt;/a&gt; as an alternative.  First step was to create a &lt;a href=&#034;2010/06/04/a_makefile_for_arduino_sketches.html&#034;&gt;Makefile&lt;/a&gt;, once I had that done I needed to configure NetBeans to use the avg-gcc toolchain, which was pretty straightforward.  Ideally I&#039;d just be able export the relevant settings from NetBeans and provide a file you could download and install, but unfortunately NetBeans doesn&#039;t provide a way to do this for individual compilers, just all of them at once :-(
&lt;/p&gt;
&lt;p&gt;
First step is to set up a new compiler configuration, &lt;code&gt;Tools -&amp;gt; Options -&amp;gt; C/C++ -&amp;gt; Add&lt;/code&gt;.  Set the base directory to wherever you have avr-gcc installed, in my case this is under &lt;code&gt;/opt/arduino/hardware/tools/gcc-avr/bin&lt;/code&gt;.  Set the compiler family to &lt;code&gt;GNU&lt;/code&gt; and save.
&lt;/p&gt;
&lt;p&gt;
Then in the &lt;code&gt;Build Tools&lt;/code&gt; tab, set the paths for the C compiler, the C++ compiler and for the assembler, i.e. the full paths to &lt;code&gt;avr-gcc&lt;/code&gt;, &lt;code&gt;avr-c++&lt;/code&gt; and &lt;code&gt;avr-as&lt;/code&gt;.  Also set the path for &lt;code&gt;gmake&lt;/code&gt;.  Clicking on the &lt;code&gt;Versions&lt;/code&gt; button should display the versions of the tools.
&lt;/p&gt;
&lt;p&gt;
Switch to the &lt;code&gt;Code Assistance&lt;/code&gt; tab, and for both the C and C++ compilers, click the &lt;code&gt;Reset Settings&lt;/code&gt; button.  This should fill in the default values, the include directories should be set to locations under your avr-gcc install tree.  You also need to manually add the directory containing the source of the Arduino libraries to each compiler configuration, in my case this is &lt;code&gt;/opt/arduino/hardware/cores/arduino&lt;/code&gt;, and them move it to the top of the include lists.
&lt;/p&gt;
&lt;p&gt;
Finally, switch to the &lt;code&gt;Other&lt;/code&gt; tab, and add &lt;code&gt;pde&lt;/code&gt; to the list of C++ file extensions, and save.  That&#039;s the tools set up.
&lt;/p&gt;
&lt;p&gt;
The next steps apply when you are creating a new project and defining its properties.  Obviously you need to choose the avr-gcc toolchain to compile the project, and provide a &lt;a href=&#034;2010/06/04/a_makefile_for_arduino_sketches.html&#034;&gt;Makefile&lt;/a&gt; to build it with - don&#039;t use the standard NetBeans one, it won&#039;t work.
&lt;/p&gt;
&lt;p&gt;
The &lt;code&gt;Code Assistance&lt;/code&gt; sections for both the C and C++ compilers need setting up to refer to any additional library directories you are using, and if you want code completion to work properly you also need to define the requisite preprocessor macros.  Do this by setting up a new Configuration for each board type you use, and within that define the macros.  I have duemilanove and mega boards, so my settings are:
&lt;/p&gt;
&lt;h4&gt;duemilanove&lt;/h4&gt;
&lt;pre&gt;__AVR_ATmega328P__
F_CPU=16000000L
&lt;/pre&gt;
&lt;h4&gt;mega&lt;/h4&gt;
&lt;pre&gt;__AVR_ATmega1280__
F_CPU=16000000L
&lt;/pre&gt;
&lt;p&gt;
If you have different boards you&#039;ll have to figure out the correct &lt;code&gt;__AVR_ATXXX__&lt;/code&gt; and &lt;code&gt;F_CPU&lt;/code&gt; #defines.  First find &lt;code&gt;boards.txt&lt;/code&gt; in your Arduino install tree and find the section for your board.  The &lt;code&gt;f_cpu&lt;/code&gt; value is what you need for &lt;code&gt;F_CPU&lt;/code&gt;, the other setting is a little more fiddly to find.  Get the &lt;code&gt;mcu&lt;/code&gt; value, then look that up in the second table on &lt;a href=&#034;http://www.nongnu.org/avr-libc/user-manual/using_tools.html&#034;&gt;this page&lt;/a&gt; to find the corresponding macro that needs to be defined.
&lt;/p&gt;
&lt;p&gt;
As the generated code needs to be run on the Arduino, the normal &lt;code&gt;Run&lt;/code&gt; settings don&#039;t actually make much sense, but we can re-purpose them for our needs.  In the &lt;code&gt;Make&lt;/code&gt; section, set the &lt;code&gt;Build Result&lt;/code&gt; value to the path of your gmake executable, then in the &lt;code&gt;Run&lt;/code&gt; section, set the command-line arguments to &lt;code&gt;upload_monitor&lt;/code&gt;.  By doing this, when you run the project with F6, NetBeans will run the &lt;code&gt;upload_monitor&lt;/code&gt; Makefile target which will build the project, upload it to the board and run the serial monitor.
&lt;/p&gt;
&lt;p&gt;
With all that in place you should be able to use NetBeans as your IDE for developing for the Arduino, including all the nice features such as cross-referencing and code completion.  The setup of projects is a little fiddly, so my suggestion is to set up an empty template project that you can copy and then change all the project name references in - I use &lt;code&gt;TEMPLATE&lt;/code&gt; as the project name so I can use a little script to clone the project then rename and batch-edit the files with the correct project name.
&lt;/p&gt;</description>
      <category>Arduino</category>
    <category>Tech</category>
    <comments>http://bleaklow.com:80/2010/06/22/configuring_netbeans_to_use_as_an_arduino_ide.html#comments</comments>
    <guid isPermaLink="true">http://bleaklow.com:80/2010/06/22/configuring_netbeans_to_use_as_an_arduino_ide.html</guid>
    <pubDate>Tue, 22 Jun 2010 19:09:00 GMT</pubDate>
  </item>
  </channel>
</rss>
