title: Move object creation to setup() function of arduino
body: <p>I've created a class that handles sending data to a led matrix (max7219).</p>
  
  <p>This is what I was doing to create an instance of the LedControl class.</p>
  
  <pre><code>LedControl lc=LedControl(11, 13, 12);// data, clock, latch;
  
  void setup() 
  {
     ...
  }
  </code></pre>
  
  <p>Now I'm trying to add timer-interrupts to my class. But I found that I can't set the appropriate registries in the initializer (<code>LedControl::LedControl()</code>). If I move this code to <code>setup</code>, it all works perfectly. My guess is that the Arduino bootloader, which uses <code>timer1</code> for PWM overwrites these registries, just before calling <code>setup()</code> but after my object has been initialized.</p>
  
  <p>So my idea was to just move the object creation to the setup function like so</p>
  
  <pre><code>// FAIL
  LedControl lc;
  
  void setup() 
  {
     lc=LedControl(11, 13, 12);// data, clock, latch;
     ...
  }
  </code></pre>
  
  <p>But then I get the error <code>no matching function for call to 'LedControl::LedControl()'</code></p>
  
  <p>I tried using pointers (<code>LedControl *lc;</code> <code>lc=&amp;LedControl(11, 13, 12);</code>), but as far as I could tell, this would mean I would have to write <code>(*lc).someFunction()</code> everywhere instead of <code>lc.someFunction()</code>. Even less elegant than moving the registry setting code to setup().</p>
  
  <p>So my question is. How do I create an object in the <code>setup()</code> function, but still have a global variable pointing to it?</p>