title: Node.js and Johnny-Five "document is not defined" error
body: <p>I am using Node.js and Johnny-Five with an Arduino Uno micro controller. My goal is to, upon pressing the button hooked up to the Arduino, the webpage will display a count of the number of times it has been pressed in the form of a bar.</p>
  
  <p>In console I get an error when I press the button that says "document is not defined" and references my variable that is supposed to change the css styling: </p>
  
  <pre><code>var bar1 = document.getElementById('bar1');
  </code></pre>
  
  <p>Not sure why that is giving an error. Any thoughts? Below is my javascript:</p>
  
  <pre><code>var five = require("johnny-five"),
    bumper, led, counter, toggleState;
    toggleState = false;
  
  five.Board().on("ready", function() {
  
    bumper = new five.Button(7);
    led = new five.Led(13);
    counter = 200;
  
    bumper.on("hit", function() {
  
      led.on();
      console.log( "Button has been pressed" );
              counter += 10; //add 10 everytime the button is pressed
  
              console.log(counter);
              toggleState = true;
              console.log("on");
  
      //function increaseBarSize () {
      if(toggleState == true) {
          var bar1 = document.getElementById('bar1');
          bar1.style.width = counter;
          console.log(bar1);
      }
  
      }).on("release", function() {
          led.off();
          console.log("off");
  
      });
  
      });
  </code></pre>