<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-917542905889928199</id><updated>2012-01-31T00:11:30.411+01:00</updated><category term='Wireless'/><category term='Windows XP'/><category term='AirPort Express'/><category term='Twitter'/><category term='Windows Vista'/><category term='Script'/><category term='Internet'/><category term='rsync'/><category term='TestDisk'/><category term='Game'/><category term='Toshiba 320CDS'/><category term='Recovery'/><category term='Noise'/><category term='LCD'/><category term='Kazehakase'/><category term='OSX'/><category term='Announcement'/><category term='Printer'/><category term='Digital twitter frame'/><category term='Emulation'/><category term='Electronics'/><category term='Arduino'/><category term='Digital picture frame'/><category term='Hard drive'/><category term='Linux'/><category term='List'/><category term='Colors'/><category term='email'/><category term='Canon CLC 3220'/><category term='Laptop'/><category term='Terminal'/><category term='cron'/><category term='LED'/><category term='GNU ddrescue'/><category term='Fan'/><category term='Hardware tips'/><category term='Software Tips'/><category term='Windows 7'/><title type='text'>Home of the generic nerd</title><subtitle type='html'>Notes, theories and random geekery.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-5594227781072426370</id><published>2011-12-14T21:44:00.001+01:00</published><updated>2011-12-16T22:32:57.078+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LED'/><category scheme='http://www.blogger.com/atom/ns#' term='Electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='Colors'/><category scheme='http://www.blogger.com/atom/ns#' term='Arduino'/><title type='text'>Arduino Mood Light Controller v3</title><content type='html'>I finally go some time and some inspiration to update the source code&amp;nbsp;of my&amp;nbsp;&lt;a href="http://genericnerd.blogspot.com/2009/05/arduino-mood-light-controller.html"&gt;Arduino Mood Light Controller&lt;/a&gt;.&amp;nbsp;I'll just try to keep it short ...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code cleanup:&lt;/b&gt;&lt;br /&gt;All the light modes have been moved to separate functions.&lt;br /&gt;Replaced a couple of "If, then..." with "Switch, Case", makes the code somewhat easier to read.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;New features:&lt;/b&gt;&lt;br /&gt;Added two light modes - cycleColor and lightMyFire.&lt;br /&gt;Speed of pulsateColor and cycleColor now controlled via potentiometer.&lt;br /&gt;&lt;br /&gt;&lt;iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/IpDfT_9Eg8w" width="420"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe allowfullscreen="" frameborder="0" height="315" src="http://www.youtube.com/embed/hI0D5adZlOc" width="420"&gt;&lt;/iframe&gt;&lt;br /&gt;&lt;br /&gt;Download the source code&amp;nbsp;&lt;a href="http://dl.dropbox.com/u/1645571/GenericNerd/ArduinoCode/rgb_mixer_controlled_pulse_makkan_v3_ino.ino"&gt;here&lt;/a&gt;.&lt;br /&gt;Source code formatted for blogger by:&amp;nbsp;&lt;a href="http://formatmysourcecode.blogspot.com/"&gt;formatmysourcecode.blogspot.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;/* &lt;br /&gt;  RGB LED controller&lt;br /&gt;  4 modes: off, color select, color pulse and random cycle/pulse&lt;br /&gt;  By Markus Ulfberg 2009-05-19&lt;br /&gt;  &lt;br /&gt;  Updated to Version 2 - 2010-01-13 (Not publicly released)&lt;br /&gt;  Updated to Version 3 - 2011-12-14&lt;br /&gt;&lt;br /&gt;  Thanks to: Ladyada, Tom Igoe and &lt;br /&gt;  everyone at the Arduino forum for excellent &lt;br /&gt;  tutorials and everyday help. &lt;br /&gt;&lt;br /&gt;  TODO: &lt;br /&gt;  1. Use millis for debounce instead of delay. &lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;// set the ledPins&lt;br /&gt;int ledRed = 10;&lt;br /&gt;int ledGreen = 9;&lt;br /&gt;int ledBlue = 11;&lt;br /&gt;&lt;br /&gt;// color selector pin&lt;br /&gt;int potPin = 1;&lt;br /&gt; &lt;br /&gt;// lightMode selector&lt;br /&gt;int switchPin = 2;&lt;br /&gt;&lt;br /&gt;// light mode variable&lt;br /&gt;// initial value 0 = off&lt;br /&gt;int lightMode = 0;&lt;br /&gt;&lt;br /&gt;// LED Power variables&lt;br /&gt;byte redPwr = 0;&lt;br /&gt;byte greenPwr = 0;&lt;br /&gt;byte bluePwr = 0;&lt;br /&gt;&lt;br /&gt;// Variables for lightMode 2&lt;br /&gt;// variables for keeping pulse color&lt;br /&gt;byte redPulse;&lt;br /&gt;byte greenPulse;&lt;br /&gt;byte bluePulse;&lt;br /&gt;int pulseSpeed; &lt;br /&gt;&lt;br /&gt;// Set pulse to down initially&lt;br /&gt;byte pulse = 0;&lt;br /&gt;&lt;br /&gt;// floating variables needed to be able to pulse a fixed color &lt;br /&gt;float redFloat;&lt;br /&gt;float greenFloat;&lt;br /&gt;float blueFloat;&lt;br /&gt;&lt;br /&gt;// the amount R,G &amp;amp; B should step up/down to display an fixed color&lt;br /&gt;float redKoff;&lt;br /&gt;float greenKoff;&lt;br /&gt;float blueKoff;&lt;br /&gt;&lt;br /&gt;// Variables for lightMode 3&lt;br /&gt;// set the initial random colors&lt;br /&gt;byte redNew = random(255);&lt;br /&gt;byte greenNew = random(255);&lt;br /&gt;byte blueNew = random(255);&lt;br /&gt;&lt;br /&gt;// Variables for cycleColor&lt;br /&gt;int truColor = 0;&lt;br /&gt;&lt;br /&gt;// misc interface variables&lt;br /&gt;// potVal store the value of the potentiometer for various needs &lt;br /&gt;int potVal;&lt;br /&gt;// value from the button (debounce)&lt;br /&gt;int switchVal;&lt;br /&gt;int switchVal2;&lt;br /&gt;// buttonState registers if the button has changed&lt;br /&gt;int buttonState;&lt;br /&gt;&lt;br /&gt;void setup()&lt;br /&gt;{&lt;br /&gt;  pinMode(ledRed, OUTPUT);&lt;br /&gt;  pinMode(ledGreen, OUTPUT);&lt;br /&gt;  pinMode(ledBlue, OUTPUT);&lt;br /&gt;  &lt;br /&gt;  pinMode(potPin, INPUT);&lt;br /&gt;  &lt;br /&gt;  pinMode(switchPin, INPUT);&lt;br /&gt;  buttonState = digitalRead(switchPin); &lt;br /&gt;  &lt;br /&gt;  // serial for debugging purposes only&lt;br /&gt;  Serial.begin(9600);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop()&lt;br /&gt;{&lt;br /&gt;  switchVal = digitalRead(switchPin);      // read input value and store it in val&lt;br /&gt;  delay(10);                         // 10 milliseconds is a good amount of time&lt;br /&gt;    &lt;br /&gt;  switchVal2 = digitalRead(switchPin);     // read the input again to check for bounces&lt;br /&gt;  if (switchVal == switchVal2) {                 // make sure we got 2 consistant readings!&lt;br /&gt;    if (switchVal != buttonState) {          // the button state has changed!&lt;br /&gt;      if (switchVal == LOW) {                // check if the button is pressed&lt;br /&gt;        switch (lightMode) {          // light is off&lt;br /&gt;          case 0:&lt;br /&gt;            lightMode = 1;           // light is on and responds to pot&lt;br /&gt;            break;  &lt;br /&gt;          case 1:&lt;br /&gt;            lightMode = 2;           // light pulsates in the latest color from pot&lt;br /&gt;            break;  &lt;br /&gt;          case 2:     &lt;br /&gt;            lightMode = 3;           // light cycles thru colors&lt;br /&gt;            break;&lt;br /&gt;          case 3:&lt;br /&gt;            lightMode = 4;           // light changes randomly&lt;br /&gt;            break;&lt;br /&gt;          case 4:&lt;br /&gt;            lightMode = 5;           // simulated fire&lt;br /&gt;            break;  &lt;br /&gt;          case 5:     &lt;br /&gt;            lightMode = 0;             // light is off        &lt;br /&gt;            break;  &lt;br /&gt;        } // END switch (lightMode)    &lt;br /&gt;      } // END if (switchVal == LOW)&lt;br /&gt;    } // END if (switchVal != buttonState) &lt;br /&gt;      &lt;br /&gt;    buttonState = switchVal;                 // save the new state in our variable&lt;br /&gt;  } // END if (switchVal == switchVal2)&lt;br /&gt;&lt;br /&gt;  /*&lt;br /&gt;  // Debug&lt;br /&gt;  Serial.print("lightMode: ");&lt;br /&gt;  Serial.println(lightMode);&lt;br /&gt;  */&lt;br /&gt;  &lt;br /&gt;  switch (lightMode) {&lt;br /&gt;    case 0:&lt;br /&gt;      lightsOff();&lt;br /&gt;      break;&lt;br /&gt;    case 1:&lt;br /&gt;      colorControl();&lt;br /&gt;      break;&lt;br /&gt;    case 2:&lt;br /&gt;      pulsateColor();&lt;br /&gt;      break;&lt;br /&gt;    case 3: &lt;br /&gt;      cycleColor();&lt;br /&gt;      break;&lt;br /&gt;    case 4:&lt;br /&gt;      randomColor();&lt;br /&gt;      break;&lt;br /&gt;    case 5:&lt;br /&gt;      lightMyFire();&lt;br /&gt;      break;  &lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;} // END loop()&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// lightMode 0&lt;br /&gt;void lightsOff() {&lt;br /&gt;  redPwr = 0;&lt;br /&gt;  greenPwr = 0;&lt;br /&gt;  bluePwr = 0;&lt;br /&gt;  colorDisplay();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// lightMode 1 &lt;br /&gt;void colorControl() {&lt;br /&gt;&lt;br /&gt;   // read the potentiometer position&lt;br /&gt;   potVal = analogRead(potPin); &lt;br /&gt; &lt;br /&gt;  // RED &amp;gt; ORANGE &amp;gt; YELLOW&lt;br /&gt;   if (potVal &amp;gt; 0 &amp;amp;&amp;amp; potVal &amp;lt; 170) {&lt;br /&gt;     redPwr = 255;&lt;br /&gt;     bluePwr = 0;&lt;br /&gt;     greenPwr = map(potVal, 0, 170, 0, 255);&lt;br /&gt;   }&lt;br /&gt; &lt;br /&gt;   // YELLOW &amp;gt; LIME?? &amp;gt; GREEN &lt;br /&gt;   if (potVal &amp;gt; 170 &amp;amp;&amp;amp; potVal &amp;lt; 341) {&lt;br /&gt;     greenPwr = 255;&lt;br /&gt;     bluePwr = 0;&lt;br /&gt;     redPwr = map(potVal, 341, 170, 0, 255);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;    // GREEN &amp;gt; TURQOUISE&lt;br /&gt;    if (potVal &amp;gt; 341 &amp;amp;&amp;amp; potVal &amp;lt; 511) {&lt;br /&gt;      greenPwr = 255;&lt;br /&gt;      redPwr = 0;&lt;br /&gt;      bluePwr = map(potVal, 341, 511, 0, 255);&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;   // TURQOUISE &amp;gt; BLUE  &lt;br /&gt;   if (potVal &amp;gt; 511 &amp;amp;&amp;amp; potVal &amp;lt; 682) {&lt;br /&gt;     bluePwr = 255;&lt;br /&gt;     redPwr = 0;&lt;br /&gt;     greenPwr = map(potVal, 682, 511, 0, 255);&lt;br /&gt;   }&lt;br /&gt; &lt;br /&gt;   // BLUE &amp;gt; PURPLE &lt;br /&gt;   if (potVal &amp;gt; 682 &amp;amp;&amp;amp; potVal &amp;lt; 852) {&lt;br /&gt;     bluePwr = 255;&lt;br /&gt;     greenPwr = 0;&lt;br /&gt;     redPwr = map(potVal, 682, 852, 0, 255);&lt;br /&gt;   }&lt;br /&gt; &lt;br /&gt;   // PURPLE &amp;gt; RED&lt;br /&gt;   if (potVal &amp;gt; 852 &amp;amp;&amp;amp; potVal &amp;lt; 1023) {&lt;br /&gt;     redPwr = 255;&lt;br /&gt;     greenPwr = 0;&lt;br /&gt;     bluePwr = map(potVal, 1023, 852, 0, 255);&lt;br /&gt;   } &lt;br /&gt;   &lt;br /&gt;   redFloat = float(redPwr);&lt;br /&gt;   greenFloat = float(greenPwr);&lt;br /&gt;   blueFloat = float(bluePwr);&lt;br /&gt;   &lt;br /&gt;   redKoff = redFloat / 255;&lt;br /&gt;   greenKoff = greenFloat / 255;&lt;br /&gt;   blueKoff = blueFloat / 255;&lt;br /&gt;   &lt;br /&gt;   redPulse = redPwr;&lt;br /&gt;   greenPulse = greenPwr;&lt;br /&gt;   bluePulse = bluePwr; &lt;br /&gt;   &lt;br /&gt;  /*&lt;br /&gt;  // Debug &lt;br /&gt;  Serial.print("redFLoat: ");&lt;br /&gt;  Serial.print(redFloat, DEC);&lt;br /&gt;  Serial.print(" redPwr: ");&lt;br /&gt;  Serial.print(redPwr, DEC);&lt;br /&gt;  Serial.print(" greenFloat: ");&lt;br /&gt;  Serial.print(greenFloat, DEC);&lt;br /&gt;  Serial.print(" greenPwr: ");&lt;br /&gt;  Serial.print(greenPwr, DEC);&lt;br /&gt;  Serial.print(" blueFloat: ");&lt;br /&gt;  Serial.print(blueFloat, DEC);&lt;br /&gt;  Serial.print(" bluePwr: ");&lt;br /&gt;  Serial.println(bluePwr, DEC);&lt;br /&gt;  // End debug&lt;br /&gt;  */&lt;br /&gt;  // Display colors &lt;br /&gt;  colorDisplay();&lt;br /&gt;}        &lt;br /&gt;&lt;br /&gt;// lightMode 2&lt;br /&gt;void pulsateColor() {&lt;br /&gt;  &lt;br /&gt;    // get colors from colorControl&lt;br /&gt;    redPwr = int(redFloat);&lt;br /&gt;    greenPwr = int(greenFloat);&lt;br /&gt;    bluePwr = int(blueFloat);&lt;br /&gt;      &lt;br /&gt;    // Read speed from potentiometer &lt;br /&gt;    pulseSpeed = analogRead(potPin); &lt;br /&gt;    pulseSpeed = map(pulseSpeed, 0, 1023, 0, 255);&lt;br /&gt;  &lt;br /&gt;    //display the colors&lt;br /&gt;    colorDisplay();&lt;br /&gt;    &lt;br /&gt;    // set speed of change&lt;br /&gt;    delay(pulseSpeed);&lt;br /&gt;    &lt;br /&gt;    // pulse down&lt;br /&gt;    if (pulse == 0) {&lt;br /&gt;      if (redFloat &amp;gt; 10) {&lt;br /&gt;        redFloat = redFloat - redKoff;&lt;br /&gt;      } &lt;br /&gt;      if (greenFloat &amp;gt; 10) {&lt;br /&gt;        greenFloat = greenFloat - greenKoff;&lt;br /&gt;      } &lt;br /&gt;      if (blueFloat &amp;gt; 10) {&lt;br /&gt;        blueFloat = blueFloat - blueKoff;&lt;br /&gt;      } &lt;br /&gt;&lt;br /&gt;    // If all xFloat match 10 get pulse up&lt;br /&gt;    if (byte(redFloat) &amp;lt;= 10) {&lt;br /&gt;     if (byte(greenFloat) &amp;lt;= 10) {&lt;br /&gt;      if (byte(blueFloat) &amp;lt;= 10) {&lt;br /&gt;       pulse = 1;&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  // Pulse up&lt;br /&gt;  if (pulse == 1) {&lt;br /&gt;    if (redFloat &amp;lt; redPulse) {&lt;br /&gt;      redFloat = redFloat + redKoff;&lt;br /&gt;    } &lt;br /&gt;    if (greenFloat &amp;lt; greenPulse) {&lt;br /&gt;      greenFloat = greenFloat + greenKoff;&lt;br /&gt;    } &lt;br /&gt;    if (blueFloat &amp;lt; bluePulse) {&lt;br /&gt;      blueFloat = blueFloat + blueKoff;&lt;br /&gt;    }&lt;br /&gt;   // If all Pwr match Pulse get pulse down&lt;br /&gt;  &lt;br /&gt;    if (byte(redFloat) == redPulse) {&lt;br /&gt;     if (byte(greenFloat) == greenPulse) {&lt;br /&gt;      if (byte(blueFloat) == bluePulse) {&lt;br /&gt;       pulse = 0;&lt;br /&gt;      }&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  /*&lt;br /&gt;  // Debug &lt;br /&gt;  Serial.print("redFloat: ");&lt;br /&gt;  Serial.print(redFloat, DEC);&lt;br /&gt;  Serial.print(" redPulse: ");&lt;br /&gt;  Serial.print(redPulse, DEC);&lt;br /&gt;  Serial.print(" greenFloat: ");&lt;br /&gt;  Serial.print(greenFloat, DEC);&lt;br /&gt;  Serial.print(" greenPulse: ");&lt;br /&gt;  Serial.print(greenPulse, DEC);&lt;br /&gt;  Serial.print(" blueFloat: ");&lt;br /&gt;  Serial.print(blueFloat, DEC);&lt;br /&gt;  Serial.print(" bluePulse: ");&lt;br /&gt;  Serial.print(bluePulse, DEC);&lt;br /&gt;  Serial.print(" pulse: ");&lt;br /&gt;  Serial.println(pulse, DEC);&lt;br /&gt;  // End debug&lt;br /&gt;  */&lt;br /&gt;  &lt;br /&gt;} // pulsateColor END &lt;br /&gt;&lt;br /&gt;// lightMode 3&lt;br /&gt;void cycleColor() {    // Cycles through colors&lt;br /&gt;&lt;br /&gt;  switch(truColor) {&lt;br /&gt;  // RED &amp;gt; ORANGE &amp;gt; YELLOW   &lt;br /&gt;   case 0:&lt;br /&gt;     redPwr = 255;&lt;br /&gt;     bluePwr = 0;&lt;br /&gt;     greenPwr++;&lt;br /&gt;     if (greenPwr &amp;gt; 254) {&lt;br /&gt;       truColor = 1;&lt;br /&gt;     }&lt;br /&gt;     break;&lt;br /&gt;   &lt;br /&gt;   // YELLOW &amp;gt; LIME?? &amp;gt; GREEN &lt;br /&gt;   case 1:&lt;br /&gt;     greenPwr = 255;&lt;br /&gt;     bluePwr = 0;&lt;br /&gt;     redPwr--;&lt;br /&gt;     if (redPwr &amp;lt; 1) {&lt;br /&gt;       truColor = 2;&lt;br /&gt;     }&lt;br /&gt;     break;&lt;br /&gt;&lt;br /&gt;   // GREEN &amp;gt; TURQOUISE&lt;br /&gt;   case 2:&lt;br /&gt;     greenPwr = 255;&lt;br /&gt;     bluePwr++;&lt;br /&gt;     redPwr = 0;&lt;br /&gt;     if (bluePwr &amp;gt; 254) {&lt;br /&gt;       truColor = 3;&lt;br /&gt;     }   &lt;br /&gt;    break;&lt;br /&gt;    &lt;br /&gt;   // TURQOUISE &amp;gt; BLUE  &lt;br /&gt;   case 3:&lt;br /&gt;     greenPwr--;&lt;br /&gt;     bluePwr = 255;&lt;br /&gt;     redPwr = 0;&lt;br /&gt;     if (greenPwr &amp;lt; 1) {&lt;br /&gt;       truColor = 4;&lt;br /&gt;     }&lt;br /&gt;     break;&lt;br /&gt;     &lt;br /&gt;   // BLUE &amp;gt; PURPLE &lt;br /&gt;   case 4:&lt;br /&gt;     greenPwr = 0;&lt;br /&gt;     bluePwr = 255;&lt;br /&gt;     redPwr++;&lt;br /&gt;     if (redPwr &amp;gt; 254) {&lt;br /&gt;       truColor = 5;&lt;br /&gt;     }&lt;br /&gt;     break;&lt;br /&gt;     &lt;br /&gt;   // PURPLE &amp;gt; RED&lt;br /&gt;   case 5:&lt;br /&gt;     greenPwr = 0;&lt;br /&gt;     bluePwr--;&lt;br /&gt;     redPwr = 255;&lt;br /&gt;     if (bluePwr &amp;lt; 1) {&lt;br /&gt;       truColor = 0;&lt;br /&gt;     }   &lt;br /&gt;     break;&lt;br /&gt; }&lt;br /&gt;  // START SPEED &lt;br /&gt;  pulseSpeed = analogRead(potPin); &lt;br /&gt;  pulseSpeed = map(pulseSpeed, 0, 1023, 0, 255);&lt;br /&gt;  &lt;br /&gt;  //display the colors&lt;br /&gt;  colorDisplay();&lt;br /&gt;  // set speed of change&lt;br /&gt;  delay(pulseSpeed);&lt;br /&gt;  // END SPEED&lt;br /&gt;  &lt;br /&gt;}  // END cycleColor &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// lightMode 4 &lt;br /&gt;void randomColor() {     // randomize colorNew and step colorPwr to it&lt;br /&gt;                          &lt;br /&gt;  if (redPwr &amp;gt; redNew) {&lt;br /&gt;    redPwr--;&lt;br /&gt;  } &lt;br /&gt;  if (redPwr &amp;lt; redNew) {&lt;br /&gt;    redPwr++;&lt;br /&gt;  }&lt;br /&gt;  if (greenPwr &amp;gt; greenNew) {&lt;br /&gt;    greenPwr--;&lt;br /&gt;  } &lt;br /&gt;  if (greenPwr &amp;lt; greenNew) {&lt;br /&gt;    greenPwr++;&lt;br /&gt;  }&lt;br /&gt;  if (bluePwr &amp;gt; blueNew) {&lt;br /&gt;    bluePwr--;&lt;br /&gt;  } &lt;br /&gt;  if (bluePwr &amp;lt; blueNew) {&lt;br /&gt;    bluePwr++;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;// If all Pwr match New get new colors&lt;br /&gt;  &lt;br /&gt;  if (redPwr == redNew) {&lt;br /&gt;   if (greenPwr == greenNew) {&lt;br /&gt;    if (bluePwr == blueNew) {&lt;br /&gt;     redNew = random(254);&lt;br /&gt;     greenNew = random(254);&lt;br /&gt;     blueNew = random(254);&lt;br /&gt;    }&lt;br /&gt;   }&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  // display the colors&lt;br /&gt;  colorDisplay();&lt;br /&gt;  // Set speed of change&lt;br /&gt;  delay(20);&lt;br /&gt;&lt;br /&gt;} // END randomColor &lt;br /&gt;&lt;br /&gt;// lightMode 5&lt;br /&gt;void lightMyFire() {&lt;br /&gt;  &lt;br /&gt;  // Flicker will determine how often a fast flare will occur&lt;br /&gt;  int flicker;&lt;br /&gt;&lt;br /&gt;  // set flicker randomness&lt;br /&gt;  flicker = random(800); &lt;br /&gt;&lt;br /&gt;  // Set random colors, &lt;br /&gt;  // constrain green to red and blue to green&lt;br /&gt;  // in order to stay within a red, blue, white spectrum&lt;br /&gt;  redPwr = random(220, 240);&lt;br /&gt;  greenPwr = random(180, 200);&lt;br /&gt;  // when flicker occur, the colors shine brighter&lt;br /&gt;  // adding blue creates a white shine &lt;br /&gt;  if (flicker &amp;gt; 750) {&lt;br /&gt;    redPwr = 254;&lt;br /&gt;    greenPwr = random(200, 230); &lt;br /&gt;    bluePwr = random(0, 50);    &lt;br /&gt;  } else {&lt;br /&gt;    bluePwr = 0;&lt;br /&gt;  }&lt;br /&gt;  &lt;br /&gt;  // display Colors&lt;br /&gt;  colorDisplay();&lt;br /&gt;  &lt;br /&gt;  // Set speed of fire&lt;br /&gt;  delay(20);  &lt;br /&gt;&lt;br /&gt;} // END lightMyFire&lt;br /&gt;&lt;br /&gt;// Displays the colors when called from other functions&lt;br /&gt;void colorDisplay() {&lt;br /&gt;  analogWrite(ledRed, redPwr);&lt;br /&gt;  analogWrite(ledGreen, greenPwr);&lt;br /&gt;  analogWrite(ledBlue, bluePwr);&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-5594227781072426370?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/5594227781072426370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2011/12/arduino-mood-light-controller-v3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5594227781072426370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5594227781072426370'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2011/12/arduino-mood-light-controller-v3.html' title='Arduino Mood Light Controller v3'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://img.youtube.com/vi/IpDfT_9Eg8w/default.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-7352898582046102255</id><published>2011-10-27T06:45:00.000+02:00</published><updated>2011-10-27T06:45:49.751+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Noise'/><category scheme='http://www.blogger.com/atom/ns#' term='Laptop'/><category scheme='http://www.blogger.com/atom/ns#' term='Fan'/><category scheme='http://www.blogger.com/atom/ns#' term='Hardware tips'/><title type='text'>How I fixed a rattling laptop fan</title><content type='html'>So my laptop fan started rattling recently. First I thought it might be my hard drive that was about to give up, so I was kind of glad it was "just" the fan. Until the noise of the fan started to drive me slightly insane. My first attempt of silencing the fan was a failure. I opened up my laptop and cleaned out all the dust in the fan and the vents. I also checked if there any loose pieces of something in the fan, but didn't find anything. After putting the laptop back together again it didn't take long for the fan to start making noise again.&lt;br /&gt;&lt;br /&gt;So yesterday evening I opened up my laptop again, about a month after my initial try. I took it one step further this time, I removed the fan completely and disassembled it up til the point where I had the fan blades removed from the housing. After cleaning everything as good as possible I &amp;nbsp;put a drop of oil (for sewing machines) on the spindle where the fan blades sit. When I had put everything back togheter I could verify that my laptop now indeed was quiet as a mouse. And yes before you ask, the fan i still working.&lt;br /&gt;&lt;br /&gt;Unfortunately I didn't take any pictures of this but hopefully it's quite easy to understand anyway. If you don't please just ask and I will try to give you an answer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-7352898582046102255?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/7352898582046102255/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2011/10/how-i-fixed-rattling-laptop-fan.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/7352898582046102255'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/7352898582046102255'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2011/10/how-i-fixed-rattling-laptop-fan.html' title='How I fixed a rattling laptop fan'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-4147683321009799269</id><published>2010-09-08T10:00:00.000+02:00</published><updated>2010-09-08T10:00:35.610+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Announcement'/><title type='text'>Hiatus</title><content type='html'>It's been a while since my last post. The reason is quite simple I've had my focus somewhere else. Late december 2009 my wife gave birth to our daughter and since then I've spent most of my free time with my two girls.&lt;br /&gt;&lt;br /&gt;Anyway I'm still alive and both new and&amp;nbsp;old projects are in the pipeline, however as of now there's simply not enough time to get things flowing again.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-4147683321009799269?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/4147683321009799269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2010/09/hiatus.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4147683321009799269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4147683321009799269'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2010/09/hiatus.html' title='Hiatus'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-4995514423579871370</id><published>2010-03-23T14:14:00.002+01:00</published><updated>2010-03-23T14:17:39.178+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='Software Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><category scheme='http://www.blogger.com/atom/ns#' term='rsync'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Super simple rsync howto</title><content type='html'>This little howto contains pretty much everything you need to&amp;nbsp;use rsync to back up and or synchronize two folders locally.&amp;nbsp;I decided to do this writeup after after reading &lt;a href="http://lifehacker.com/software/rsync/geek-to-live--mirror-files-across-systems-with-rsync-196122.php"&gt;this article&lt;/a&gt; on lifehacker. I wasn't completely satisfied with the article so I did some digging to get the answers I needed. I know there's alot of rsync tutorials out there but I wrote this for my own personal use and also I tried to keep it as short as possible while explaining what's being done.&lt;br /&gt;&lt;br /&gt;Oh, by the way rsync is really powerful and this only scratches the surface of what rsync can do. But you don't need more info to do local back ups. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Syntax:&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rsync -options /source /destination&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Compare two folders&lt;/span&gt;&lt;br /&gt;This command uses the "-v" and "-n" option to do nothing. Instead rsync prints out what would have been copied from a source folder to a destination folder. To delete files from the destination folder see notes on "--delete" below.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rsync -rvn /source /destination&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-r, --recursive recurse into directories&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-v, --verbose increase verbosity&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-n, --dry-run perform a trial run with no changes made&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Back up one folder to another&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span"&gt;This is all you need to back up a source directory to a destination directory. If unsure try it out with the "-n" dry run option first. To delete files from the destination folder see notes on "--delete" below.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rsync -av /source /destination&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-a, --archive archive mode; equals -rlptgoD (no -H,-A,-X)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-r, --recursive recurse into directories&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-l, --links copy symlinks as symlinks&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-p, --perms preserve permissions&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-t, --times preserve modification times&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-g, --group preserve group&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-o, --owner preserve owner (super-user only)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;-D same as --devices --specials&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;--devices preserve device files (super-user only)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;--specials preserve special files&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Additional tips n tricks&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Test with the "dry run" -n option first to see what files would be deleted and copied.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-n, --dry-run perform a trial run with no changes made&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Delete files in the destination folder that does not exist in the source folder.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;--delete delete extraneous files from dest dirs&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Exclude files that you don't need for instance system files.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;--exclude=PATTERN exclude files matching PATTERN&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;b&gt;example:&lt;/b&gt; --exclude '.DS_Store'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Compress files during transfer to save bandwidth&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;-z, --compress compress file data during the transfer&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;Credits&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;rsync - &lt;a href="http://samba.anu.edu.au/ftp/rsync/rsync.html"&gt;man page&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;lifehacker.com -&amp;nbsp;&lt;a href="http://lifehacker.com/software/rsync/geek-to-live--mirror-files-across-systems-with-rsync-196122.php"&gt;Geek to Live: Mirror files across systems with rsync&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;techgage.com - &lt;a href="http://techgage.com/article/backing_up_your_linux/"&gt;Backing Up Your Linux&lt;/a&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-4995514423579871370?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/4995514423579871370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2010/03/super-simple-rsync-howto.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4995514423579871370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4995514423579871370'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2010/03/super-simple-rsync-howto.html' title='Super simple rsync howto'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-1744128407027274598</id><published>2010-03-23T13:37:00.000+01:00</published><updated>2010-03-23T13:37:30.499+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Terminal'/><title type='text'>Working with files and folders that has spaces in their names</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Verdana; font-size: 13px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;I was in OSX's terminal yesterday trying to cd into a folder with a space in the name. That usually works really well with &lt;a href="http://en.wikipedia.org/wiki/Command_line_completion"&gt;tab-completion&lt;/a&gt; but in the same place in the directory tree there were &amp;nbsp;another folder with the same name but without the space.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;Here's a little illustration to clarify what I just wrote. &amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;root--+&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;|&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;+--Folder1&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;+--Folder1 With Space&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;So I want to cd into "Folder1 With Space" but I can't use &lt;a href="http://en.wikipedia.org/wiki/Command_line_completion"&gt;tab-completion&lt;/a&gt; or type:&amp;nbsp;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd Folder1 With Space&amp;nbsp;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;However I can use \ as the escape character:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd Folder1\ With\ Space&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;I can also use quotes, 'normal' or "double" (useful if the folder uses either one in it's name).&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd 'Folder1 With Space'&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;div style="margin-bottom: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;cd "Folder1 With Space"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Although I haven't tried it I'm pretty sure this works in any *nix terminal.&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-1744128407027274598?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/1744128407027274598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2010/03/working-with-files-and-folders-that-has.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/1744128407027274598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/1744128407027274598'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2010/03/working-with-files-and-folders-that-has.html' title='Working with files and folders that has spaces in their names'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-23880816400129816</id><published>2010-01-30T08:57:00.001+01:00</published><updated>2010-02-05T09:06:32.062+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Game'/><category scheme='http://www.blogger.com/atom/ns#' term='LCD'/><category scheme='http://www.blogger.com/atom/ns#' term='Electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='Arduino'/><title type='text'>Arduino game: Zombie Showdown with graphics</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3utbOaMVL14/S2PlEYVPWpI/AAAAAAAAQlk/ZHXasCISK_Q/s1600-h/20100130004.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_3utbOaMVL14/S2PlEYVPWpI/AAAAAAAAQlk/ZHXasCISK_Q/s320/20100130004.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Shortly after I wrote a &lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1263329681"&gt;post&lt;/a&gt; about&amp;nbsp; &lt;a href="http://genericnerd.blogspot.com/2010/01/arduino-game-zombie-showdown.html"&gt;Zombie Showdown&lt;/a&gt; at the &lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl"&gt;Arduino forum&lt;/a&gt;, Bart had a suggestion on how the game could evolve with graphics. My original idea wasn't really to make a game with graphics but rather with physical input and feedback, but I admit I got a bit tempted to try graphics out. But before I got around to, Bart did. Here's the result of my game with Barts graphics. &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_3utbOaMVL14/S2PlCh45j7I/AAAAAAAAQlc/rjPhr71W6vg/s1600-h/20100130006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_3utbOaMVL14/S2PlCh45j7I/AAAAAAAAQlc/rjPhr71W6vg/s320/20100130006.jpg" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;i style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif;"&gt;Attacking Zombie!&lt;/i&gt; &lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3utbOaMVL14/S2PlAAWANFI/AAAAAAAAQlU/Utt6OI4inBE/s1600-h/20100130012.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_3utbOaMVL14/S2PlAAWANFI/AAAAAAAAQlU/Utt6OI4inBE/s320/20100130012.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: center;"&gt;&lt;i&gt; Killed Zombie.&lt;/i&gt;&lt;/div&gt;&lt;div style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: center;"&gt;&lt;i&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/bYbsQDPGdj8&amp;hl=sv&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/bYbsQDPGdj8&amp;hl=sv&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="font-family: Times,&amp;quot;Times New Roman&amp;quot;,serif; text-align: center;"&gt;&lt;i&gt;Gameplay video. &lt;/i&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.markusulfberg.se/slask/arduino/Makkan_Blammers_ZombieShowdown.pde"&gt;Dowload the code (.pde) here.&lt;/a&gt;&lt;br /&gt;Formatted for Blogger with: &lt;a href="http://formatmysourcecode.blogspot.com/"&gt;formatmysourcecode.blogspot.com&lt;/a&gt;.&lt;/div&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;/* &lt;br /&gt;  Zombie Showdown&lt;br /&gt;  By Markus Ulfberg 2010-01-12&lt;br /&gt;  &lt;br /&gt;  'Graphics' ;) added by Bart Lammers 2010-01-22&lt;br /&gt;  &lt;br /&gt;  More Arduino stuff and future updates of Zombie Showdown at:&lt;br /&gt;  http://genericnerd.blogspot.com&lt;br /&gt;&lt;br /&gt;  Description:&lt;br /&gt;    A small game using an 16x2 LCD and a pushbutton.&lt;br /&gt;    The game presents a start screen and awaits player input. &lt;br /&gt;    If the player presses the button the game starts.&lt;br /&gt;    &lt;br /&gt;    After a random number of milliseconds a Zombie will &lt;br /&gt;    appear. It will have a random strenght of 1-5. &lt;br /&gt;    The strenght of the Zombie is equal to how many&lt;br /&gt;    buttonpresses it takes to kill it. &lt;br /&gt;    &lt;br /&gt;    If the player fails to kill the Zombie within a random &lt;br /&gt;    timeframe the Zombie will kill the player.&lt;br /&gt;    &lt;br /&gt;    If the player manages to kill the Zombie the game will&lt;br /&gt;    continue and a new Zombie will soon attack. &lt;br /&gt;    &lt;br /&gt;    When the player dies a Game Over screen is presented&lt;br /&gt;    also displaying the score of the player. &lt;br /&gt;    &lt;br /&gt;    There is no "beating" this game since in the Zombie apocalypse&lt;br /&gt;    eventually everyone will die. &lt;br /&gt;&lt;br /&gt;  Planned expansion:&lt;br /&gt;    1. Use a vibrator to signal Zombie attack.&lt;br /&gt;    2. Use randomizer to make &lt;br /&gt;  &lt;br /&gt;  Credits:&lt;br /&gt;    This game uses example code from &lt;br /&gt;    Debounce and the LiquidCrystal library.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// include the library code:&lt;br /&gt;#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// initialize the library with the numbers of the interface pins&lt;br /&gt;LiquidCrystal lcd(7, 8, 9, 10, 11, 12);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Set the text strings used in the game&lt;br /&gt;char* gameText[]={"Zombie Showdown",// 0 Title &lt;br /&gt;                  "Kill to Start",  // 1 &lt;br /&gt;                  "Let's go!",      // 2&lt;br /&gt;                  "Zombie!!!",      // 3                  &lt;br /&gt;                  "You killed it.", // 4&lt;br /&gt;                  "You are dead.",  // 5&lt;br /&gt;                  "Game Over",      // 6&lt;br /&gt;                  "Score: "         // 7&lt;br /&gt;                  };         &lt;br /&gt;&lt;br /&gt;// Custom characters for the zombie graphics&lt;br /&gt;byte zombie_head[8] = {&lt;br /&gt;  B00000,&lt;br /&gt;  B00110,&lt;br /&gt;  B01111,&lt;br /&gt;  B11101,&lt;br /&gt;  B11111,&lt;br /&gt;  B11100,&lt;br /&gt;  B11011,&lt;br /&gt;  B11110,&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;byte zombie_body[8] = {&lt;br /&gt;  B11100,&lt;br /&gt;  B11111,&lt;br /&gt;  B11111,&lt;br /&gt;  B11100,&lt;br /&gt;  B11100,&lt;br /&gt;  B11100,&lt;br /&gt;  B11100,&lt;br /&gt;  B11100,&lt;br /&gt;};&lt;br /&gt;byte zombie_arm[8] = {&lt;br /&gt;  B00000,&lt;br /&gt;  B11110,&lt;br /&gt;  B11111,&lt;br /&gt;  B00001,&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;byte zombie_head_expl[8] = {&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;  B00000,&lt;br /&gt;  B01000,&lt;br /&gt;  B11011,&lt;br /&gt;  B11110,&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// Button variables&lt;br /&gt;const int buttonPin = 2;&lt;br /&gt;&lt;br /&gt;// Two values for debounceing&lt;br /&gt;int buttonState;&lt;br /&gt;int lastButtonState = LOW;&lt;br /&gt;&lt;br /&gt;// the following variables are long's because the time, measured in miliseconds,&lt;br /&gt;// will quickly become a bigger number than can be stored in an int.&lt;br /&gt;long lastDebounceTime = 0;  // the last time the output pin was toggled&lt;br /&gt;long debounceDelay = 50;    // the debounce time; increase if the output flickers&lt;br /&gt;&lt;br /&gt;// Stores value of button 1 = pressed 0 = released &lt;br /&gt;int buttonPress = 0;&lt;br /&gt;&lt;br /&gt;// Title screen blink variables&lt;br /&gt;long lastBlinkTime = 0;&lt;br /&gt;long blinkDelay = 500;&lt;br /&gt;int blinkState = 0;&lt;br /&gt;&lt;br /&gt;// Gameplay variables&lt;br /&gt;&lt;br /&gt;// Zombie health a random number between 1 and 5&lt;br /&gt;int zombie;&lt;br /&gt;&lt;br /&gt;// Time since last zombie apperance&lt;br /&gt;long lastZombieTime = 0;&lt;br /&gt;&lt;br /&gt;// Randomizes between each zombie &lt;br /&gt;// Timer for next zombie apperance&lt;br /&gt;// a random number between 200 ms and 20 000 ms &lt;br /&gt;long zombieDelay;&lt;br /&gt;&lt;br /&gt;// Randomizes between each zombie &lt;br /&gt;// Countdown timer for zombie bite&lt;br /&gt;// a random number between 2 000 ms and 7 000 ms &lt;br /&gt;long zombieBite;&lt;br /&gt;&lt;br /&gt;// Status of zombie apperance 1 = zombie 0 = no zombie&lt;br /&gt;int zombieState = 0;&lt;br /&gt;&lt;br /&gt;// Total steps the zombie can take&lt;br /&gt;int zombieSteps = 15;&lt;br /&gt;int zombiePosition = 0;&lt;br /&gt;int zombieLastPosition = 0;&lt;br /&gt;int zombieSpeed = 0;&lt;br /&gt;&lt;br /&gt;// Status of player 1 = alive 0 = dead&lt;br /&gt;int playerAlive = 1;&lt;br /&gt;&lt;br /&gt;// gameRun sets start screen or runs the game&lt;br /&gt;int gameRun = 0;&lt;br /&gt;&lt;br /&gt;// Score&lt;br /&gt;int score = 0;&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;  &lt;br /&gt;  // set up the LCD's number of rows and columns: &lt;br /&gt;  lcd.begin(16, 2);&lt;br /&gt;  &lt;br /&gt;  // DEBUG ONLY&lt;br /&gt;  Serial.begin(9600);&lt;br /&gt;    &lt;br /&gt;  // Set up the button&lt;br /&gt;  pinMode(buttonPin, INPUT);&lt;br /&gt;  buttonState = digitalRead(buttonPin); &lt;br /&gt;  &lt;br /&gt;  // Use unconnected analog input pin&lt;br /&gt;  // to generate a random seed for the random generator&lt;br /&gt;  randomSeed(analogRead(0));&lt;br /&gt;  &lt;br /&gt;  // Generate zombie characters&lt;br /&gt;  lcd.createChar(0, zombie_head);&lt;br /&gt;  lcd.createChar(1, zombie_body);&lt;br /&gt;  lcd.createChar(2, zombie_arm);&lt;br /&gt;  lcd.createChar(3, zombie_head_expl);&lt;br /&gt;  &lt;br /&gt;  // The timeframe where a new Zombie appears &lt;br /&gt;  // this first Zombie will have a shorter random time frame &lt;br /&gt;  zombieDelay = random(200,10000);&lt;br /&gt;  &lt;br /&gt;  // The timeframe for the first zombie bite&lt;br /&gt;  zombieBite = random(2000,7000);&lt;br /&gt;  setZombieSpeed();&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;  &lt;br /&gt;  // Start sequence&lt;br /&gt;  gameStart();&lt;br /&gt;   &lt;br /&gt;  // Gameplay&lt;br /&gt;  gameExecute();&lt;br /&gt;  &lt;br /&gt;  // GameOver&lt;br /&gt;  gameOver();&lt;br /&gt;  &lt;br /&gt;} // loop end&lt;br /&gt;&lt;br /&gt;void gameStart() {&lt;br /&gt;  &lt;br /&gt;  while (gameRun == 0) {&lt;br /&gt;    // Set the cursor&lt;br /&gt;    lcd.setCursor(0,0);&lt;br /&gt;    &lt;br /&gt;    // print the name of the game&lt;br /&gt;    lcd.print(gameText[0]);&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;    // Pause for blink&lt;br /&gt;    if ((millis() - lastBlinkTime) &amp;gt; blinkDelay) {&lt;br /&gt;    &lt;br /&gt;      // If blinkState is OFF turn it ON&lt;br /&gt;      if (blinkState == 0) {&lt;br /&gt;      &lt;br /&gt;        // Clear the LCD and set the cursor&lt;br /&gt;        lcd.clear();&lt;br /&gt;    &lt;br /&gt;        // move the cursor down &lt;br /&gt;        lcd.setCursor(0,1);&lt;br /&gt;        // print the blinking text&lt;br /&gt;        lcd.print(gameText[1]);&lt;br /&gt;    &lt;br /&gt;        // Set the cursor for non blinking text&lt;br /&gt;        lcd.setCursor(0,0);&lt;br /&gt;    &lt;br /&gt;        // since blink cleared the whole LCD&lt;br /&gt;        // we need print the name of the game again&lt;br /&gt;        lcd.print(gameText[0]);&lt;br /&gt;      &lt;br /&gt;        // set blinkState to ON&lt;br /&gt;        blinkState = 1;&lt;br /&gt;      // If blinkState is OFF turn it ON&lt;br /&gt;      } else {&lt;br /&gt;      &lt;br /&gt;        // Clear the LCD and set the cursor&lt;br /&gt;        lcd.clear();&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;        // Set the cursor for non blinking text&lt;br /&gt;        lcd.setCursor(0,0);&lt;br /&gt;    &lt;br /&gt;        // print the name of the game&lt;br /&gt;        lcd.print(gameText[0]);&lt;br /&gt;      &lt;br /&gt;        // Set blink to OFF&lt;br /&gt;        blinkState = 0;&lt;br /&gt;      &lt;br /&gt;      } // END: else &lt;br /&gt;    &lt;br /&gt;      // store the new blink time&lt;br /&gt;      lastBlinkTime = millis();&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;    } // END: if ((millis() - lastBlinkTime) &amp;gt; blinkDelay)&lt;br /&gt;    &lt;br /&gt;    // Check if button is pressed &lt;br /&gt;    if (button() == 1) {&lt;br /&gt;      // If so start the game&lt;br /&gt;      gameRun = 1;&lt;br /&gt;      playerAlive = 1;&lt;br /&gt;      &lt;br /&gt;      // reset score&lt;br /&gt;      score = 0;&lt;br /&gt;    } // END: if (button() == 1)&lt;br /&gt;    &lt;br /&gt;  } // END: while game start    &lt;br /&gt;} // END: void gameStart &lt;br /&gt;&lt;br /&gt;void gameExecute() {&lt;br /&gt;  // check wether button is pushed to run game&lt;br /&gt;  while (gameRun == 1) {&lt;br /&gt;      lcd.clear();&lt;br /&gt;      lcd.print(gameText[2]);&lt;br /&gt;      // small delay to get ready&lt;br /&gt;      delay(2000);&lt;br /&gt; &lt;br /&gt;      // Check if a zombie is here&lt;br /&gt;      if (zombieState == 1) {&lt;br /&gt;        // tell the player that a zombie is here&lt;br /&gt;        lcd.clear();         &lt;br /&gt;        // lcd.print(gameText[3]);&lt;br /&gt;        // Put the zombie in position 0;&lt;br /&gt;        drawZombie();&lt;br /&gt;       &lt;br /&gt;        // Set the strenght and speed of of the zombie&lt;br /&gt;        zombie = random(1,5);&lt;br /&gt;             &lt;br /&gt;         // Resets the zombie timer &lt;br /&gt;         // this one is for the speed of which the zombie attacks &lt;br /&gt;         lastZombieTime = millis(); &lt;br /&gt;       &lt;br /&gt;        // The action part&lt;br /&gt;        while (zombie &amp;gt; 0) {&lt;br /&gt;         // Find out where the zombie has to stand&lt;br /&gt;         zombiePosition = ((millis() - lastZombieTime) / zombieSpeed);&lt;br /&gt;         &lt;br /&gt;         if (zombiePosition != zombieLastPosition) {&lt;br /&gt;            // If it moved, redraw&lt;br /&gt;            zombieLastPosition = zombiePosition;&lt;br /&gt;            drawZombie();&lt;br /&gt;         }&lt;br /&gt;         &lt;br /&gt;         /* // DEBUG &lt;br /&gt;         Serial.print("Str: ");&lt;br /&gt;         Serial.print(zombie, DEC);&lt;br /&gt;         Serial.print(" Time: ");&lt;br /&gt;         Serial.print(zombieBite);&lt;br /&gt;         Serial.print(" Bite: ");  &lt;br /&gt;         Serial.println((millis() - lastZombieTime));&lt;br /&gt;         */ // END: DEBUG&lt;br /&gt;         &lt;br /&gt;         // Check if button is pressed &lt;br /&gt;         if (button() == 1) {&lt;br /&gt;           // If so remove 1 health from zombie&lt;br /&gt;           zombie--;&lt;br /&gt;         }&lt;br /&gt;        &lt;br /&gt;         // check if the zombie bites&lt;br /&gt;         if ((millis() - lastZombieTime) &amp;gt; zombieBite) {&lt;br /&gt;            &lt;br /&gt;           // player is bitten and killed&lt;br /&gt;           // Print information on death&lt;br /&gt;           lcd.clear();&lt;br /&gt;           lcd.print(gameText[5]);      &lt;br /&gt;           delay(2000);&lt;br /&gt;            &lt;br /&gt;           // Make sure all loops are exited&lt;br /&gt;           gameRun = 0;&lt;br /&gt;           zombie = 0;&lt;br /&gt;         }&lt;br /&gt;          &lt;br /&gt;       } // END: while zombie &amp;gt; 0&lt;br /&gt;     &lt;br /&gt;       // Add score, first check if the zombie was killed or &lt;br /&gt;       // it was the player who died and zombie was just reset&lt;br /&gt;       if (gameRun == 1) {&lt;br /&gt;         // The zombie was killed &lt;br /&gt;         zombieState = 0;&lt;br /&gt;         // Add to the players score&lt;br /&gt;         score++;&lt;br /&gt;         //lcd.clear();&lt;br /&gt;         // Print information of kill&lt;br /&gt;         //lcd.print(gameText[4]);&lt;br /&gt;         lcd.setCursor(zombiePosition,0);&lt;br /&gt;         lcd.write(3);&lt;br /&gt;         // Pause for a while&lt;br /&gt;         delay(1000);&lt;br /&gt;       } &lt;br /&gt;        &lt;br /&gt;     } else { // END: if Zombie State and Start else &lt;br /&gt;      &lt;br /&gt;       // zombieState is 0 check if enough time &lt;br /&gt;       // has passed since last zombie&lt;br /&gt;       if ((millis() - lastZombieTime) &amp;gt; zombieDelay) {&lt;br /&gt;         // A new zombie is here&lt;br /&gt;         zombieState = 1;&lt;br /&gt;         // reset random zombieDelay&lt;br /&gt;         zombieDelay = random(200,2000);&lt;br /&gt;        &lt;br /&gt;         // reset random zombieBite time;&lt;br /&gt;         zombieBite = random(2000,7000);&lt;br /&gt;         setZombieSpeed();&lt;br /&gt;         &lt;br /&gt;         // reset position&lt;br /&gt;         zombiePosition = 0;&lt;br /&gt;         zombieLastPosition = 0;&lt;br /&gt;         &lt;br /&gt;       } // END: if ((millis() - lastZombieTime) &amp;gt; zombieDelay)&lt;br /&gt;     &lt;br /&gt;     } // END: else &lt;br /&gt;&lt;br /&gt;  }  // END: while game run &lt;br /&gt;  &lt;br /&gt;} // END: gameExecute &lt;br /&gt;&lt;br /&gt;// Calculate the zombie speed, how many ms per step?&lt;br /&gt;void setZombieSpeed() {&lt;br /&gt;  zombieSpeed = zombieBite / zombieSteps;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Draw the zombie on the screen in the correct position&lt;br /&gt;void drawZombie() {&lt;br /&gt; lcd.clear();&lt;br /&gt; lcd.setCursor(zombiePosition,0);&lt;br /&gt; lcd.write(0);&lt;br /&gt; lcd.setCursor(zombiePosition,1);&lt;br /&gt; lcd.write(1);&lt;br /&gt; lcd.setCursor(zombiePosition+1,1);&lt;br /&gt; lcd.write(2); &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;int button() {&lt;br /&gt;  // read the state of the switch into a local variable:&lt;br /&gt;  int reading = digitalRead(buttonPin);&lt;br /&gt;&lt;br /&gt;  // check to see if you just pressed the button &lt;br /&gt;  // (i.e. the input went from LOW to HIGH),  and you've waited &lt;br /&gt;  // long enough since the last press to ignore any noise:  &lt;br /&gt;&lt;br /&gt;  // If the switch changed, due to noise or pressing:&lt;br /&gt;  if (reading != lastButtonState) {&lt;br /&gt;    // reset the debouncing timer&lt;br /&gt;    lastDebounceTime = millis();&lt;br /&gt;  } &lt;br /&gt;  &lt;br /&gt;  if ((millis() - lastDebounceTime) &amp;gt; debounceDelay) {&lt;br /&gt;    // whatever the reading is at, it's been there for longer&lt;br /&gt;    // than the debounce delay, so take it as the actual current state:&lt;br /&gt;    buttonState = reading;    &lt;br /&gt;            &lt;br /&gt;    // If button is pressed down &lt;br /&gt;    if (buttonState == HIGH) {&lt;br /&gt;      // store the state of the button&lt;br /&gt;      buttonPress = 1;             &lt;br /&gt;    }&lt;br /&gt;    // If button is up ...&lt;br /&gt;    if (buttonState == LOW) {&lt;br /&gt;      // ... and was just down i.e released&lt;br /&gt;      if (buttonPress == 1) {&lt;br /&gt;        // Store the new state of the button&lt;br /&gt;        buttonPress = 0;&lt;br /&gt;        &lt;br /&gt;        // also save the reading since we terminate in the next step        &lt;br /&gt;        lastButtonState = reading;      &lt;br /&gt;        &lt;br /&gt;        // Terminate the button() function and return &lt;br /&gt;        // a positive button press&lt;br /&gt;        return 1;&lt;br /&gt;      }&lt;br /&gt;    } // END: If buttonState == LOW&lt;br /&gt;  } // END: If millis... &lt;br /&gt;  &lt;br /&gt;  // save the reading.  Next time through the loop,&lt;br /&gt;  // it'll be the lastButtonState:&lt;br /&gt;  lastButtonState = reading;&lt;br /&gt;  &lt;br /&gt;} // END: void button()&lt;br /&gt;  &lt;br /&gt;void gameOver() {&lt;br /&gt;  lcd.clear();&lt;br /&gt;  lcd.setCursor(0,0);&lt;br /&gt;  // Print Game Over&lt;br /&gt;  lcd.print(gameText[6]);&lt;br /&gt;  lcd.setCursor(0,1);&lt;br /&gt;  // Print Score&lt;br /&gt;  lcd.print(gameText[7]);&lt;br /&gt;  lcd.print(score);&lt;br /&gt;  // Pause for a while &lt;br /&gt;  delay(4000); &lt;br /&gt;  &lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-23880816400129816?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/23880816400129816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2010/01/arduino-game-zombie-showdown-with.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/23880816400129816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/23880816400129816'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2010/01/arduino-game-zombie-showdown-with.html' title='Arduino game: Zombie Showdown with graphics'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3utbOaMVL14/S2PlEYVPWpI/AAAAAAAAQlk/ZHXasCISK_Q/s72-c/20100130004.jpg' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-4196973342451414584</id><published>2010-01-12T20:03:00.002+01:00</published><updated>2010-01-24T20:11:32.772+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Game'/><category scheme='http://www.blogger.com/atom/ns#' term='LCD'/><category scheme='http://www.blogger.com/atom/ns#' term='Electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='Arduino'/><title type='text'>Arduino game: Zombie Showdown</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_3utbOaMVL14/S0yiDRLVNvI/AAAAAAAAQfE/RZFuZNLHvJo/s1600-h/20091212004.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_3utbOaMVL14/S0yiDRLVNvI/AAAAAAAAQfE/RZFuZNLHvJo/s320/20091212004.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;I recently bought a &lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=37&amp;amp;products_id=181"&gt;16x2 LCD&lt;/a&gt; from &lt;a href="http://www.adafruit.com/"&gt;Adafruit&lt;/a&gt;&amp;nbsp;and decided to make a small Zombie survival game as my first project.&lt;br /&gt;The hardware is just the LCD hooked up according to instructions on the LCD &lt;a href="http://www.adafruit.com/index.php?main_page=product_info&amp;amp;cPath=37&amp;amp;products_id=181"&gt;product page&lt;/a&gt; and a push-button with a pull-down resistor like the one in this &lt;a href="http://www.ladyada.net/learn/arduino/lesson5.html"&gt;tutorial&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;Here are som pictures and a movie from the project:&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3utbOaMVL14/S0yiGQ36lvI/AAAAAAAAQfM/FUf9CzYbEQA/s1600-h/20100112061.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_3utbOaMVL14/S0yiGQ36lvI/AAAAAAAAQfM/FUf9CzYbEQA/s320/20100112061.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;Title screen of Zombie Showdown&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3utbOaMVL14/S0yiJSl2mnI/AAAAAAAAQfU/fFkxHQReoAc/s1600-h/20100112062.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_3utbOaMVL14/S0yiJSl2mnI/AAAAAAAAQfU/fFkxHQReoAc/s320/20100112062.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;Entire hardware set up&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/oY-rP8u6rZA&amp;hl=sv&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/oY-rP8u6rZA&amp;hl=sv&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;Gameplay&amp;nbsp;&lt;/i&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Download the&amp;nbsp;&lt;a href="http://www.markusulfberg.se/slask/arduino/Makkan_ZombieShowdown.pde"&gt;source code&lt;/a&gt;&amp;nbsp;or read it below.&lt;br /&gt;Formatted for Blogger with: &lt;a href="http://formatmysourcecode.blogspot.com/"&gt;formatmysourcecode.blogspot.com&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;/* &lt;br /&gt;  Zombie Showdown&lt;br /&gt;  By Markus Ulfberg 2010-01-12&lt;br /&gt;  &lt;br /&gt;  More Arduino stuff and future updates of Zombie Showdown at:&lt;br /&gt;  http://genericnerd.blogspot.com&lt;br /&gt;&lt;br /&gt;  Description:&lt;br /&gt;    A small game using an 16x2 LCD and a pushbutton.&lt;br /&gt;    The game presents a start screen and awaits player input. &lt;br /&gt;    If the player presses the button the game starts.&lt;br /&gt;    &lt;br /&gt;    After a random number of milliseconds a Zombie will &lt;br /&gt;    appear. It will have a random strenght of 1-5. &lt;br /&gt;    The strenght of the Zombie is equal to how many&lt;br /&gt;    buttonpresses it takes to kill it. &lt;br /&gt;    &lt;br /&gt;    If the player fails to kill the Zombie within a random &lt;br /&gt;    timeframe the Zombie will kill the player.&lt;br /&gt;    &lt;br /&gt;    If the player manages to kill the Zombie the game will&lt;br /&gt;    continue and a new Zombie will soon attack. &lt;br /&gt;    &lt;br /&gt;    When the player dies a Game Over screen is presented&lt;br /&gt;    also displaying the score of the player. &lt;br /&gt;    &lt;br /&gt;    There is no "beating" this game since in the Zombie apocalypse&lt;br /&gt;    eventually everyone will die. &lt;br /&gt;&lt;br /&gt;  Planned expansion:&lt;br /&gt;    1. Use a vibrator to signal Zombie attack.&lt;br /&gt;    2. Use randomizer to make &lt;br /&gt;  &lt;br /&gt;  Credits:&lt;br /&gt;    This game uses example code from &lt;br /&gt;    Debounce and the LiquidCrystal library.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// include the library code:&lt;br /&gt;#include &amp;lt;LiquidCrystal.h&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// initialize the library with the numbers of the interface pins&lt;br /&gt;LiquidCrystal lcd(7, 8, 9, 10, 11, 12);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Set the text strings used in the game&lt;br /&gt;char* gameText[]={"Zombie Showdown",// 0 Title &lt;br /&gt;                  "Kill to Start",  // 1 &lt;br /&gt;                  "Let's go!",      // 2&lt;br /&gt;                  "Zombie!!!",      // 3                  &lt;br /&gt;                  "You killed it.", // 4&lt;br /&gt;                  "You are dead.",  // 5&lt;br /&gt;                  "Game Over",      // 6&lt;br /&gt;                  "Score: "         // 7&lt;br /&gt;                  };         &lt;br /&gt;&lt;br /&gt;// Button variables&lt;br /&gt;const int buttonPin = 2;&lt;br /&gt;&lt;br /&gt;// Two values for debounceing&lt;br /&gt;int buttonState;&lt;br /&gt;int lastButtonState = LOW;&lt;br /&gt;&lt;br /&gt;// the following variables are long's because the time, measured in miliseconds,&lt;br /&gt;// will quickly become a bigger number than can be stored in an int.&lt;br /&gt;long lastDebounceTime = 0;  // the last time the output pin was toggled&lt;br /&gt;long debounceDelay = 50;    // the debounce time; increase if the output flickers&lt;br /&gt;&lt;br /&gt;// Stores value of button 1 = pressed 0 = released &lt;br /&gt;int buttonPress = 0;&lt;br /&gt;&lt;br /&gt;// Title screen blink variables&lt;br /&gt;long lastBlinkTime = 0;&lt;br /&gt;long blinkDelay = 500;&lt;br /&gt;int blinkState = 0;&lt;br /&gt;&lt;br /&gt;// Gameplay variables&lt;br /&gt;&lt;br /&gt;// Zombie health a random number between 1 and 5&lt;br /&gt;int zombie;&lt;br /&gt;&lt;br /&gt;// Time since last zombie apperance&lt;br /&gt;long lastZombieTime = 0;&lt;br /&gt;&lt;br /&gt;// Randomizes between each zombie &lt;br /&gt;// Timer for next zombie apperance&lt;br /&gt;// a random number between 200 ms and 20 000 ms &lt;br /&gt;long zombieDelay;&lt;br /&gt;&lt;br /&gt;// Randomizes between each zombie &lt;br /&gt;// Countdown timer for zombie bite&lt;br /&gt;// a random number between 2 000 ms and 7 000 ms &lt;br /&gt;long zombieBite;&lt;br /&gt;&lt;br /&gt;// Status of zombie apperance 1 = zombie 0 = no zombie&lt;br /&gt;int zombieState = 0;&lt;br /&gt;&lt;br /&gt;// Status of player 1 = alive 0 = dead&lt;br /&gt;int playerAlive = 1;&lt;br /&gt;&lt;br /&gt;// gameRun sets start screen or runs the game&lt;br /&gt;int gameRun = 0;&lt;br /&gt;&lt;br /&gt;// Score&lt;br /&gt;int score = 0;&lt;br /&gt;&lt;br /&gt;void setup() {&lt;br /&gt;  &lt;br /&gt;  // set up the LCD's number of rows and columns: &lt;br /&gt;  lcd.begin(16, 2);&lt;br /&gt;  &lt;br /&gt;  // DEBUG ONLY&lt;br /&gt;  Serial.begin(9600);&lt;br /&gt;    &lt;br /&gt;  // Set up the button&lt;br /&gt;  pinMode(buttonPin, INPUT);&lt;br /&gt;  buttonState = digitalRead(buttonPin); &lt;br /&gt;  &lt;br /&gt;  // Use unconnected analog input pin&lt;br /&gt;  // to generate a random seed for the random generator&lt;br /&gt;  randomSeed(analogRead(0));&lt;br /&gt;  &lt;br /&gt;  // The timeframe where a new Zombie appears &lt;br /&gt;  // this first Zombie will have a shorter random time frame &lt;br /&gt;  zombieDelay = random(200,10000);&lt;br /&gt;  &lt;br /&gt;  // The timeframe for the first zombie bite&lt;br /&gt;  zombieBite = random(2000,7000);&lt;br /&gt;  &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop() {&lt;br /&gt;  &lt;br /&gt;  // Start sequence&lt;br /&gt;  gameStart();&lt;br /&gt;   &lt;br /&gt;  // Gameplay&lt;br /&gt;  gameExecute();&lt;br /&gt;  &lt;br /&gt;  // GameOver&lt;br /&gt;  gameOver();&lt;br /&gt;  &lt;br /&gt;} // loop end&lt;br /&gt;&lt;br /&gt;void gameStart() {&lt;br /&gt;  &lt;br /&gt;  while (gameRun == 0) {&lt;br /&gt;    // Set the cursor&lt;br /&gt;    lcd.setCursor(0,0);&lt;br /&gt;    &lt;br /&gt;    // print the name of the game&lt;br /&gt;    lcd.print(gameText[0]);&lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;    // Pause for blink&lt;br /&gt;    if ((millis() - lastBlinkTime) &amp;gt; blinkDelay) {&lt;br /&gt;    &lt;br /&gt;      // If blinkState is OFF turn it ON&lt;br /&gt;      if (blinkState == 0) {&lt;br /&gt;      &lt;br /&gt;        // Clear the LCD and set the cursor&lt;br /&gt;        lcd.clear();&lt;br /&gt;    &lt;br /&gt;        // move the cursor down &lt;br /&gt;        lcd.setCursor(0,1);&lt;br /&gt;        // print the blinking text&lt;br /&gt;        lcd.print(gameText[1]);&lt;br /&gt;    &lt;br /&gt;        // Set the cursor for non blinking text&lt;br /&gt;        lcd.setCursor(0,0);&lt;br /&gt;    &lt;br /&gt;        // since blink cleared the whole LCD&lt;br /&gt;        // we need print the name of the game again&lt;br /&gt;        lcd.print(gameText[0]);&lt;br /&gt;      &lt;br /&gt;        // set blinkState to ON&lt;br /&gt;        blinkState = 1;&lt;br /&gt;      // If blinkState is OFF turn it ON&lt;br /&gt;      } else {&lt;br /&gt;      &lt;br /&gt;        // Clear the LCD and set the cursor&lt;br /&gt;        lcd.clear();&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;        // Set the cursor for non blinking text&lt;br /&gt;        lcd.setCursor(0,0);&lt;br /&gt;    &lt;br /&gt;        // print the name of the game&lt;br /&gt;        lcd.print(gameText[0]);&lt;br /&gt;      &lt;br /&gt;        // Set blink to OFF&lt;br /&gt;        blinkState = 0;&lt;br /&gt;      &lt;br /&gt;      } // END: else &lt;br /&gt;    &lt;br /&gt;      // store the new blink time&lt;br /&gt;      lastBlinkTime = millis();&lt;br /&gt;    &lt;br /&gt;&lt;br /&gt;    } // END: if ((millis() - lastBlinkTime) &amp;gt; blinkDelay)&lt;br /&gt;    &lt;br /&gt;    // Check if button is pressed &lt;br /&gt;    if (button() == 1) {&lt;br /&gt;      // If so start the game&lt;br /&gt;      gameRun = 1;&lt;br /&gt;      playerAlive = 1;&lt;br /&gt;      &lt;br /&gt;      // reset score&lt;br /&gt;      score = 0;&lt;br /&gt;    } // END: if (button() == 1)&lt;br /&gt;    &lt;br /&gt;  } // END: while game start    &lt;br /&gt;} // END: void gameStart &lt;br /&gt;&lt;br /&gt;void gameExecute() {&lt;br /&gt;  // check wether button is pushed to run game&lt;br /&gt;  while (gameRun == 1) {&lt;br /&gt;      lcd.clear();&lt;br /&gt;      lcd.print(gameText[2]);&lt;br /&gt;      // small delay to get ready&lt;br /&gt;      delay(2000);&lt;br /&gt; &lt;br /&gt;      // Check if a zombie is here&lt;br /&gt;      if (zombieState == 1) {&lt;br /&gt;        // tell the player that a zombie is here&lt;br /&gt;        lcd.clear();         &lt;br /&gt;        lcd.print(gameText[3]);&lt;br /&gt;       &lt;br /&gt;       &lt;br /&gt;        // Set the strenght and speed of of the zombie&lt;br /&gt;        zombie = random(1,5);&lt;br /&gt;             &lt;br /&gt;         // Resets the zombie timer &lt;br /&gt;         // this one is for the speed of which the zombie attacks &lt;br /&gt;         lastZombieTime = millis(); &lt;br /&gt;       &lt;br /&gt;        // The action part&lt;br /&gt;        while (zombie &amp;gt; 0) {&lt;br /&gt;        &lt;br /&gt;         /* // DEBUG &lt;br /&gt;         Serial.print("Str: ");&lt;br /&gt;         Serial.print(zombie, DEC);&lt;br /&gt;         Serial.print(" Time: ");&lt;br /&gt;         Serial.print(zombieBite);&lt;br /&gt;         Serial.print(" Bite: ");  &lt;br /&gt;         Serial.println((millis() - lastZombieTime));&lt;br /&gt;         */ // END: DEBUG&lt;br /&gt;         &lt;br /&gt;         // Check if button is pressed &lt;br /&gt;         if (button() == 1) {&lt;br /&gt;           // If so remove 1 health from zombie&lt;br /&gt;           zombie--;&lt;br /&gt;         }&lt;br /&gt;        &lt;br /&gt;         // check if the zombie bites&lt;br /&gt;         if ((millis() - lastZombieTime) &amp;gt; zombieBite) {&lt;br /&gt;            &lt;br /&gt;           // player is bitten and killed&lt;br /&gt;           // Print information on death&lt;br /&gt;           lcd.clear();&lt;br /&gt;           lcd.print(gameText[5]);      &lt;br /&gt;           delay(2000);&lt;br /&gt;            &lt;br /&gt;           // Make sure all loops are exited&lt;br /&gt;           gameRun = 0;&lt;br /&gt;           zombie = 0;&lt;br /&gt;         }&lt;br /&gt;          &lt;br /&gt;       } // END: while zombie &amp;gt; 0&lt;br /&gt;     &lt;br /&gt;       // Add score, first check if the zombie was killed or &lt;br /&gt;       // it was the player who died and zombie was just reset&lt;br /&gt;       if (gameRun == 1) {&lt;br /&gt;         // The zombie was killed &lt;br /&gt;         zombieState = 0;&lt;br /&gt;         // Add to the players score&lt;br /&gt;         score++;&lt;br /&gt;         lcd.clear();&lt;br /&gt;         // Print information of kill&lt;br /&gt;         lcd.print(gameText[4]);&lt;br /&gt;         // Pause for a while&lt;br /&gt;         delay(1000);&lt;br /&gt;       } &lt;br /&gt;        &lt;br /&gt;     } else { // END: if Zombie State and Start else &lt;br /&gt;      &lt;br /&gt;       // zombieState is 0 check if enough time &lt;br /&gt;       // has passed since last zombie&lt;br /&gt;       if ((millis() - lastZombieTime) &amp;gt; zombieDelay) {&lt;br /&gt;         // A new zombie is here&lt;br /&gt;         zombieState = 1;&lt;br /&gt;         // reset random zombieDelay&lt;br /&gt;         zombieDelay = random(200,2000);&lt;br /&gt;        &lt;br /&gt;         // reset random zombieBite time;&lt;br /&gt;         zombieBite = random(2000,7000);&lt;br /&gt;         &lt;br /&gt;       } // END: if ((millis() - lastZombieTime) &amp;gt; zombieDelay)&lt;br /&gt;     &lt;br /&gt;     } // END: else &lt;br /&gt;&lt;br /&gt;  }  // END: while game run &lt;br /&gt;  &lt;br /&gt;} // END: gameExecute &lt;br /&gt;&lt;br /&gt;int button() {&lt;br /&gt;  // read the state of the switch into a local variable:&lt;br /&gt;  int reading = digitalRead(buttonPin);&lt;br /&gt;&lt;br /&gt;  // check to see if you just pressed the button &lt;br /&gt;  // (i.e. the input went from LOW to HIGH),  and you've waited &lt;br /&gt;  // long enough since the last press to ignore any noise:  &lt;br /&gt;&lt;br /&gt;  // If the switch changed, due to noise or pressing:&lt;br /&gt;  if (reading != lastButtonState) {&lt;br /&gt;    // reset the debouncing timer&lt;br /&gt;    lastDebounceTime = millis();&lt;br /&gt;  } &lt;br /&gt;  &lt;br /&gt;  if ((millis() - lastDebounceTime) &amp;gt; debounceDelay) {&lt;br /&gt;    // whatever the reading is at, it's been there for longer&lt;br /&gt;    // than the debounce delay, so take it as the actual current state:&lt;br /&gt;    buttonState = reading;    &lt;br /&gt;            &lt;br /&gt;    // If button is pressed down &lt;br /&gt;    if (buttonState == HIGH) {&lt;br /&gt;      // store the state of the button&lt;br /&gt;      buttonPress = 1;             &lt;br /&gt;    }&lt;br /&gt;    // If button is up ...&lt;br /&gt;    if (buttonState == LOW) {&lt;br /&gt;      // ... and was just down i.e released&lt;br /&gt;      if (buttonPress == 1) {&lt;br /&gt;        // Store the new state of the button&lt;br /&gt;        buttonPress = 0;&lt;br /&gt;        &lt;br /&gt;        // also save the reading since we terminate in the next step        &lt;br /&gt;        lastButtonState = reading;      &lt;br /&gt;        &lt;br /&gt;        // Terminate the button() function and return &lt;br /&gt;        // a positive button press&lt;br /&gt;        return 1;&lt;br /&gt;      }&lt;br /&gt;    } // END: If buttonState == LOW&lt;br /&gt;  } // END: If millis... &lt;br /&gt;  &lt;br /&gt;  // save the reading.  Next time through the loop,&lt;br /&gt;  // it'll be the lastButtonState:&lt;br /&gt;  lastButtonState = reading;&lt;br /&gt;  &lt;br /&gt;} // END: void button()&lt;br /&gt;  &lt;br /&gt;void gameOver() {&lt;br /&gt;  lcd.clear();&lt;br /&gt;  lcd.setCursor(0,0);&lt;br /&gt;  // Print Game Over&lt;br /&gt;  lcd.print(gameText[6]);&lt;br /&gt;  lcd.setCursor(0,1);&lt;br /&gt;  // Print Score&lt;br /&gt;  lcd.print(gameText[7]);&lt;br /&gt;  lcd.print(score);&lt;br /&gt;  // Pause for a while &lt;br /&gt;  delay(4000); &lt;br /&gt;  &lt;br /&gt;}  &lt;br /&gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-4196973342451414584?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/4196973342451414584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2010/01/arduino-game-zombie-showdown.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4196973342451414584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4196973342451414584'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2010/01/arduino-game-zombie-showdown.html' title='Arduino game: Zombie Showdown'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3utbOaMVL14/S0yiDRLVNvI/AAAAAAAAQfE/RZFuZNLHvJo/s72-c/20091212004.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-7935059088129449099</id><published>2010-01-06T20:03:00.006+01:00</published><updated>2010-01-06T23:45:32.660+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Kazehakase'/><category scheme='http://www.blogger.com/atom/ns#' term='Software Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital twitter frame'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital picture frame'/><category scheme='http://www.blogger.com/atom/ns#' term='Toshiba 320CDS'/><title type='text'>How to start Kazehakase in full screen mode</title><content type='html'>&lt;span style="font-size: x-large;"&gt;The long story:&lt;/span&gt;&lt;br /&gt;I've been thinking about changing my &lt;a href="http://genericnerd.blogspot.com/2009/05/converting-toshiba-320cds-to-digital.html"&gt;Digital Picture Frame&lt;/a&gt; / &lt;a href="http://genericnerd.blogspot.com/2009/10/twitterframe.html"&gt;Twitter frame&lt;/a&gt; to use/be browser instead. Partly to be able to get a useful outlet while practicing PHP-coding but also to be able to use services such as &lt;a href="http://twitter.com/"&gt;Twitter&lt;/a&gt; and &lt;a href="http://www.tomscott.com/"&gt;Tom Scotts&lt;/a&gt; &lt;a href="http://www.tomscott.com/weather/starwars/"&gt;Star Wars weather&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;My browser of choice is&amp;nbsp;&lt;a href="http://kazehakase.sourceforge.jp/"&gt;Kazehakase&lt;/a&gt;,&amp;nbsp;a small foot print browser that can use either the Webkit or the Gecko rendering engine. It can handle alot more than &lt;a href="http://www.dillo.org/"&gt;Dillo&lt;/a&gt; but uses way less resources than Firefox.&amp;nbsp;I found out about Kazehakase while reading&amp;nbsp;the blog of&amp;nbsp;&lt;a href="http://kmandla.wordpress.com/"&gt;K. Mandla&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;However there is a problem. Kazehakase is not a very well documented browser. In it's &lt;a href="http://kazehakase.sourceforge.jp/wiki/?manual"&gt;manual&lt;/a&gt; there is a reference to using "Actions" with the browser, but the actions themselves aren't documented. Luckily enough I found out how to start Kazehakase in full screen mode by some trial and error.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-large;"&gt;The short story:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;kazehakase -a "ToggleFullScreen" your_url_here&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-7935059088129449099?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/7935059088129449099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2010/01/how-to-start-kazehakase-in-full-screen.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/7935059088129449099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/7935059088129449099'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2010/01/how-to-start-kazehakase-in-full-screen.html' title='How to start Kazehakase in full screen mode'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-4082738523438065955</id><published>2009-12-16T08:50:00.006+01:00</published><updated>2010-01-06T20:26:00.764+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Software Tips'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows 7'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows XP'/><title type='text'>Software tips: Ninite - excellent tool for installing multiple freeware apps</title><content type='html'>&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3utbOaMVL14/SyiID9d8HaI/AAAAAAAAA8k/iWKHVHqCPN0/s1600-h/Bild+1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_3utbOaMVL14/SyiID9d8HaI/AAAAAAAAA8k/iWKHVHqCPN0/s640/Bild+1.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;My harddrive started to make lot's of wierd noises the a while back so I took the preemptive decision to buy a new one. And luck has it I was following &lt;a href="http://twitter.com/macegr"&gt;Macegr&lt;/a&gt;s twitter-feed, where he tweeted about how terrific &lt;a href="http://ninite.com/"&gt;Ninite&lt;/a&gt; was when he had to reinstall Windows 7. I gave it a shot yesterday and I can do nothing more than to agree with him. I got all my apps installed quickly and effortless - just as advertised.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-4082738523438065955?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/4082738523438065955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/12/software-tips-ninite-excellent-tool-for.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4082738523438065955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/4082738523438065955'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/12/software-tips-ninite-excellent-tool-for.html' title='Software tips: Ninite - excellent tool for installing multiple freeware apps'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_3utbOaMVL14/SyiID9d8HaI/AAAAAAAAA8k/iWKHVHqCPN0/s72-c/Bild+1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-874898707887434237</id><published>2009-12-08T07:11:00.000+01:00</published><updated>2009-12-08T07:11:46.055+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AirPort Express'/><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='Wireless'/><title type='text'>Wireless issues on Macs</title><content type='html'>&lt;b&gt;Problem: &lt;/b&gt;My coworker had some issues with her wireless network at home. Her Macbook running OS X 10.5 Leopard would connect to their home network without any problems. But her husbands Powerbook and their older stationary Mac would not connect at all. There were no hardware problems with the Powerbook, in fact it worked without a hitch at her husbands job. And ofcourse they had tried retyping the password a million times.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Solution: &lt;/b&gt;While helping another friend of mine with his AirPort Express I came across a couple of posts in different forums that suggested using WPA2 Personal encryption (AES) instead of WPA1 Personal encryption (TKIP). We tried that and it temporarily solved the issues he had, but it there were other problems in that network. However, when I told my coworker to change her encryption from WPA1 (TKIP) to WPA2 (AES) it worked like a charm and all the computers in the network got connected right away.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Short version:&lt;/b&gt; If you have wireless issues (inability to connect, dropping connection) on Macintosh hardware give WPA2 (AES) a try it might work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-874898707887434237?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/874898707887434237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/12/wireless-issues-on-macs.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/874898707887434237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/874898707887434237'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/12/wireless-issues-on-macs.html' title='Wireless issues on Macs'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-532584334729370180</id><published>2009-12-03T08:56:00.003+01:00</published><updated>2009-12-03T09:06:45.758+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LED'/><category scheme='http://www.blogger.com/atom/ns#' term='Electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Colors'/><category scheme='http://www.blogger.com/atom/ns#' term='Arduino'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>DIY ambient tv light inspired by ME!!</title><content type='html'>&lt;object height="300" width="400"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=7857892&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1"&gt;&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=7857892&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" height="300" width="400"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Szymon took my &lt;a href="http://genericnerd.blogspot.com/2009/05/arduino-mood-light-controller.html"&gt;Arduino powered mood light&lt;/a&gt; to another level. &lt;a href="http://geekswithblogs.net/kobush/archive/2009/11/27/136572.aspx"&gt;Check out his DIY ambient TV light&lt;/a&gt;. Me myself and I are very proud to have inspired such a project and really happy to see stuff I've created evolve in other peoples hands.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-532584334729370180?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/532584334729370180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/12/diy-ambient-tv-light-inspired-by-me.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/532584334729370180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/532584334729370180'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/12/diy-ambient-tv-light-inspired-by-me.html' title='DIY ambient tv light inspired by ME!!'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-6049809413434198696</id><published>2009-12-02T19:42:00.002+01:00</published><updated>2010-03-02T14:47:00.820+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Hard drive'/><category scheme='http://www.blogger.com/atom/ns#' term='TestDisk'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Recovery'/><category scheme='http://www.blogger.com/atom/ns#' term='GNU ddrescue'/><title type='text'>Trying to recover data from a failing hard drive</title><content type='html'>My brother in-law asked me to take a look at his girlfriends computer (a laptop) that wouldn't boot up. Quite soon it stood apparent that the computer failed to find a bootable hard drive. I had a similar issue after trying to install Fedora 11 on my laptop.&lt;br /&gt;This issue, I found out, had something to do with the SATA controller being set to AHCI- or Legacy-mode. I got my drive bootable again by fiddling with this setting a couple of times and rebooting the computer. When I got the drive to boot again, I set it to AHCI-mode which is the default.&lt;br /&gt;But that was my fully operational drive, not the one in question here.&lt;br /&gt;&lt;span style="font-size: 130%;"&gt;&lt;br /&gt;Trying it on another computer&lt;/span&gt;&lt;br /&gt;This drive wouldn't even show up in BIOS. Since it is a laptop there's really not much I can do but remove the drive and hook it up to another computer. So I bought a &lt;a href="http://www.deltaco.eu/details.aspx?PID=SATA-61"&gt;SATA/IDE adapter kit from Deltaco&lt;/a&gt;, a small device that let's me connect any 2.5" and 3.5" PATA or SATA drive to a USB-port.&lt;br /&gt;I hooked the drive up and connected it to my own laptop. I could hear the drive spin up and make some other noises before it showed up in both Windows Vista (not as a regular drive, &lt;span style="color: red;"&gt;&lt;span style="color: black;"&gt;but visible in the administrative tools disk management)&lt;/span&gt; &lt;/span&gt;and Ubuntu Linux. Since it's far easier to find freeware resuce applications under Linux I went with Ubuntu.&lt;br /&gt;&lt;span style="font-size: 130%;"&gt;&lt;br /&gt;Tools of rescue&lt;/span&gt;&lt;br /&gt;From what I found from googling hard drive resuce under linux there seemed to be two main applications to use. &lt;a href="http://www.gnu.org/software/ddrescue/ddrescue.html"&gt;GNU ddrescue&lt;/a&gt; and &lt;a href="http://www.cgsecurity.org/wiki/TestDisk"&gt;TestDisk&lt;/a&gt; both available in the default Ubuntu repositories under the names &lt;span style="font-weight: bold;"&gt;gddrescue&lt;/span&gt; and &lt;span style="font-weight: bold;"&gt;testdisk&lt;/span&gt;.&lt;br /&gt;First it gave TestDisk a try, but since it didn't even list the drive I resorted back to a tutorial  on the TestDisk site on how to recover data from a &lt;a href="http://www.cgsecurity.org/wiki/Damaged_Hard_Disk"&gt;damaged hard disk&lt;/a&gt; using GNU ddrescue. But unfortunately this seemed to have quite little effect. All I got was that the rescue was done but no data what so ever was copied. I tried fdisk, cfdisk and gparted to access the drive directly but all of them reported failure. &lt;span style="color: black;"&gt;As I'm writing this I'm starting to wonder wether or not the "visible" drive is in fact the USB-controller and not the drive itself?&lt;span style="font-style: italic; font-weight: bold;"&gt; (edit: It is!)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 130%;"&gt;The last resort: Stick it in the freezer&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;So now I was stuck with the quite annoying feeling that the drive was broken beyond my ability to resuce it. And I wanted so to be the hero here and let the others bask in my geeky glory. However after a good nights sleep I started to recall another more unorthodox way of getting data from a failed drive by sticking it in the freezer.&lt;br /&gt;Again I went to the great oracle of google and found many different &lt;a href="http://geeksaresexy.blogspot.com/2006/01/freeze-your-hard-drive-to-recover-data.html"&gt;success testimonials&lt;/a&gt; using this procedure. The important part seemed to be to protect the drive from moisture by bagging it in a zip lock bag before sticking it in the freezer. There were also some methods involving sticking the drive in the oven to dry it out then freezing it again, but that seemed a bit to tedious.&lt;br /&gt;To protect the drive from static I first put it in a anti static bag then in a plastic freezer bag (I guess that's the swedish equivalent to a zip lock bag, minus the zip lock) then I sucked all the air out of the bags, just like my mother tought me to do when freezing freshly baked bread. Then I took another freezer bag and put the bagged drive in and sucked the air out of that one too. Then it was freezer time for the drive. My freezer is set to - 18 °C  and the drive will be in there for about ten hours before I do the first test.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 130%;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;Well the freezing didn't help. My guess is that it is a mechanical problem and the only hope now is to pay the big bucks to get a specialized disk recovery firm to take a look at it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-6049809413434198696?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/6049809413434198696/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/12/trying-to-recover-data-from-failing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/6049809413434198696'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/6049809413434198696'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/12/trying-to-recover-data-from-failing.html' title='Trying to recover data from a failing hard drive'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-5767912708627291190</id><published>2009-10-20T12:32:00.000+02:00</published><updated>2009-10-21T12:32:39.501+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital twitter frame'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital picture frame'/><category scheme='http://www.blogger.com/atom/ns#' term='Twitter'/><category scheme='http://www.blogger.com/atom/ns#' term='Toshiba 320CDS'/><title type='text'>Twitterframe</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3utbOaMVL14/St69Wy1VzDI/AAAAAAAAAy8/JKVUqeJ8A1Q/s1600-h/DTF_2.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_3utbOaMVL14/St69Wy1VzDI/AAAAAAAAAy8/JKVUqeJ8A1Q/s400/DTF_2.jpg" alt="" id="BLOGGER_PHOTO_ID_5394957602936704050" border="0" /&gt;&lt;/a&gt;I got kind of bored of my &lt;a href="http://genericnerd.blogspot.com/2009/05/converting-toshiba-320cds-to-digital.html"&gt;digital picture frame&lt;/a&gt;, like i normally do when a project is finished. So I wanted to do something else with it. One of the things I wanted to try to use was the command line interface instead of X. The idea was to get some nice scrolling text on the screen. An IRC-frame sounded like a nice idea until I realized I really want the system to be automatic and since IRC sometimes requires you to interact I decided to go with &lt;a href="http://twitter.com/"&gt;twitter&lt;/a&gt; instead.&lt;br /&gt;&lt;br /&gt;I surfed around and found that &lt;a href="http://mike.verdone.ca/twitter/"&gt;PTT&lt;/a&gt; (Python Twitter Tools) seemed to be what I needed. To install PTT in Debian (I guess the same goes for all other debian derivatives like Ubuntu and so on) you first need to install the packages python-twitter and python-setuptools, and their respective dependencies.&lt;br /&gt;To do this simply type the following in a console/terminal:&lt;br /&gt;sudo aptitude install python-twitter python-setuptools&lt;br /&gt;&lt;br /&gt;Then install installed PTT with:&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;sudo easy_install twitter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now it's just a matter of either using the proper command line options to get PTT to do your bidding. To get an idea of what you can do simply type:&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;twitter -h&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Since I like config-files I created one in my home dir called .twitter (this also happens to be the default config file PTT looks for. This is what my .twitter file contains:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;[twitter]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;email: myemailadress@someplace.com&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;password: mytwitterpassword&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;format: verbose&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;format: ansi&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The email and password options are pretty self explanatory if you have a twitter account. Format however is the way twitter presents itself on your screen.&lt;br /&gt;format: verbose | Prints out the full twitter post rather than just one line as per default.&lt;br /&gt;format: ansi | Uses ansi coloring on the different usernames.&lt;br /&gt;&lt;br /&gt;Since .twitter contains your password it can be a good idea to only allow your user to read it:&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;chmod 400 .twitter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now that I had PTT working the way I wanted I simply added "twitter -r" to my .bash_profile to have it automatically launch after my system boots up. The "-r" causes PTT to continue running and updating the twitter feeds every five minutes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_3utbOaMVL14/St7h2ieeIdI/AAAAAAAAAzE/v2f8mWfdsHc/s1600-h/DTF_1.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 300px;" src="http://1.bp.blogspot.com/_3utbOaMVL14/St7h2ieeIdI/AAAAAAAAAzE/v2f8mWfdsHc/s400/DTF_1.jpg" alt="" id="BLOGGER_PHOTO_ID_5394997730720227794" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-5767912708627291190?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/5767912708627291190/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/10/twitterframe.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5767912708627291190'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5767912708627291190'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/10/twitterframe.html' title='Twitterframe'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_3utbOaMVL14/St69Wy1VzDI/AAAAAAAAAy8/JKVUqeJ8A1Q/s72-c/DTF_2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-8784780578694244731</id><published>2009-09-22T13:23:00.004+02:00</published><updated>2009-10-03T23:00:04.182+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Script'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital picture frame'/><title type='text'>Determine if user is logged in remotely or locally</title><content type='html'>Since I do all the maintenance on the digital picture frame via ssh I don't want the same login scripts to run when i log in remotely as when I log in locally. Well to be more specific I don't really log in locally but the user I have created logs in automatically when the DPF is turned on and from there on a number of things start. Needless to say I don't need to run "startx" everytime I log in via ssh.&lt;br /&gt;&lt;br /&gt;So I wrote a small script to help me determine whether or not I was logged in locally or remotely (via ssh). The script is in its bare form here, I use it in my .bash_profile but you might find another use for it.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Important note: This script doesn't really determine if a user is logged in locally or remotely but rather using a tty or pts although the latter usually means that the user is logged in remotely, but not always. ;)&lt;br /&gt;&lt;pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"&gt;&lt;code&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;#&lt;br /&gt;# tty-vs-pts.sh&lt;br /&gt;# tty vs pts checker by Markus Ulfberg 2009-09-22&lt;br /&gt;# Inteded use is running different scripts wether&lt;br /&gt;# the user logs in remotely or locally.&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;# Get the name of the tty the user is on.&lt;br /&gt;FULL_USER_TTY=`tty`&lt;br /&gt;# strip everything but tty or pts from the string that "tty" produces.&lt;br /&gt;USER_TTY=${FULL_USER_TTY:5:3}&lt;br /&gt;&lt;br /&gt;# Check if it is tty or pts.&lt;br /&gt;if [ $USER_TTY == 'tty' ]&lt;br /&gt;      then&lt;br /&gt;              echo "You are logged in locally using: $FULL_USER_TTY"&lt;br /&gt;&lt;br /&gt;      else&lt;br /&gt;              if [ $USER_TTY == 'pts' ]&lt;br /&gt;                      then&lt;br /&gt;                              echo "You are logged in remotely using: $FULL_USER_TTY"&lt;br /&gt;      else&lt;br /&gt;              # Return failure if it is neither.&lt;br /&gt;              echo "Failed to establish type of tty"&lt;br /&gt;              fi&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span"   style="font-family:Georgia, serif;font-size:130%;"&gt;&lt;span class="Apple-style-span"  style=" line-height: normal; white-space: normal;font-size:16px;"&gt;&lt;span class="Apple-style-span"   style="font-family:monospace;font-size:100%;"&gt;&lt;span class="Apple-style-span"  style=" line-height: 14px; white-space: pre;font-size:12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;Formatted for blogger using: &lt;a href="http://formatmysourcecode.blogspot.com/"&gt;formatmysourcecode.blogspot.com&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-8784780578694244731?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/8784780578694244731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/09/script-to-determine-if-user-is-logged.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/8784780578694244731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/8784780578694244731'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/09/script-to-determine-if-user-is-logged.html' title='Determine if user is logged in remotely or locally'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-5021576053263846550</id><published>2009-06-17T08:40:00.002+02:00</published><updated>2009-06-17T08:52:01.344+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Printer'/><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='cron'/><category scheme='http://www.blogger.com/atom/ns#' term='Canon CLC 3220'/><title type='text'>Waking up a sleeping printer</title><content type='html'>The printer (a&lt;a href="http://www.canon.co.uk/for_work/products/professional_print/digital_colour_production/CLC3220/index.asp"&gt; Canon CLC 3220&lt;/a&gt;) at my office takes quite some time to warm up and calibrate after waking up from sleep mode. Anyone who wants to print out something at the beginning of the work day knows this. And it can be quite stressful if you have to get something out for an early morning meeting.&lt;br /&gt;&lt;br /&gt;Currently sleep mode is activated after four hours of inactivity. A quite reasonable time I think. So instead of fiddling with the sleep setting I added the following line to the crontab of our server:&lt;br /&gt;&lt;br /&gt;&lt;pre style="border: 1px dashed rgb(153, 153, 153); padding: 5px; overflow: auto; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; color: rgb(0, 0, 0); background-color: rgb(238, 238, 238); font-size: 12px; line-height: 14px; width: 100%;"&gt;&lt;code&gt;   0    7    *    1-6,8-12     1-5    echo | lpr&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This line prints an empty page every morning at 7 each workday, except in july when the office is closed. Thus the printer is calibrated and ready to go when people start arriving at the office around 8 in the morning.&lt;br /&gt;&lt;br /&gt;Our server is an Xserve running OSX and for this to work I had to install the printer drivers on the server. Also setting the printer to default helps I think (though I didn't have to since we only use one).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-5021576053263846550?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/5021576053263846550/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/06/waking-up-sleeping-printer.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5021576053263846550'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5021576053263846550'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/06/waking-up-sleeping-printer.html' title='Waking up a sleeping printer'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-5898307638678122032</id><published>2009-05-19T13:06:00.002+02:00</published><updated>2011-12-16T22:38:16.492+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LED'/><category scheme='http://www.blogger.com/atom/ns#' term='Electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='Colors'/><category scheme='http://www.blogger.com/atom/ns#' term='Arduino'/><title type='text'>Arduino Mood light controller</title><content type='html'>&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;UPDATE: &lt;/span&gt;&lt;span class="Apple-style-span"&gt;New source code and videos&amp;nbsp;&lt;a href="http://genericnerd.blogspot.com/2011/12/arduino-mood-light-controller-v3.html"&gt;here.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Background&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;/span&gt;I love black and white, especially white. But I also love color, however I tend to change what type of color I like ALOT. So when saw the concept of coloring a surface with light I knew I had to try it at home.&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;b&gt; The hardware&lt;/b&gt; &lt;span class="Apple-style-span" style="font-weight: normal;"&gt;I decided to use my new found love the &lt;a href="http://www.arduino.cc/"&gt;Arduino micro controller&lt;/a&gt; to control some sort of light. At first I thought about using &lt;a href="http://www.ikea.com/us/en/catalog/products/50119407"&gt;IKEAS DIODER&lt;/a&gt; but as &lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236091181"&gt;MikMo pointed out&lt;/a&gt; the &lt;a href="http://www.dealextreme.com/details.dx/sku.14965"&gt;RGB LED strip&lt;/a&gt; from &lt;a href="http://www.dealextreme.com/"&gt;Deal Extreme&lt;/a&gt; is quite a much better deal. A little over $16 and free shipping from Hong Kong.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt; What I wanted to achive&lt;/b&gt; &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span style="font-size: 100%;"&gt;Select a specific color&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;Pulsate the specified color&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: 100%;"&gt;Random color swash i.e. go smoothly from color to color.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/span&gt;&lt;/ol&gt;&lt;div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;b&gt;Controlling the colors&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-size: 16px;"&gt;I decided to use a ULN2003 with the Arduino to control the &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: 16px;"&gt;&lt;a href="http://www.dealextreme.com/details.dx/sku.14965"&gt;DX RGB LED strip&lt;/a&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: 16px;"&gt;. It can handle enough amps to drive the LED strip and it's also alot neater than multiple transistors.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;div style="text-align: center;"&gt;Arduino control of LED strip via ULN2003&lt;br /&gt;RGB LED strip 400 mA @ 12 V&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_3utbOaMVL14/ShKRhyg4rhI/AAAAAAAAAr0/L0-l_pTI6wY/s1600-h/layout_RGBstrip.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5337488518068874770" src="http://4.bp.blogspot.com/_3utbOaMVL14/ShKRhyg4rhI/AAAAAAAAAr0/L0-l_pTI6wY/s400/layout_RGBstrip.png" style="cursor: pointer; display: block; height: 272px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-size: 85%;"&gt;R1 = 10K Potentiometer (Color selector) R2 = 100 Ohm (Pin protector)&lt;br /&gt;R3 = 10K Ohm (Pulldown resistor) S1 = Switch (Mode selector)&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt; One potentiometer to rule them all&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size: 100%;"&gt;When I first started out mixing RGB colors I used three potentiometers, one for each color. This ofcourse gives you a high resolution but also three different knobs. So inspired by the &lt;a href="http://www.consumer.philips.com/consumer/en/gb/consumer/cc/_language_gb/_productid_LCS5001_05_GB_CONSUMER"&gt;Philips LivingColors&lt;/a&gt;, I decided to streamline my color control using only one potentiometer connected to an analog in pin on the Arduino.&lt;/span&gt;&lt;span class="Apple-style-span" style="color: red; font-size: 100%;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="font-size: 100%;"&gt; &lt;br /&gt;As you can see in the picture below the value 0 on the analog pin is full red and then changes through the color circle back to red as the value reaches 1023.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_3utbOaMVL14/ScyJ5qp6zYI/AAAAAAAAAk0/8UqWr2s_G-M/s1600-h/colour_circle.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5317776883813371266" src="http://3.bp.blogspot.com/_3utbOaMVL14/ScyJ5qp6zYI/AAAAAAAAAk0/8UqWr2s_G-M/s400/colour_circle.png" style="cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: left; width: 343px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;span style="font-size: 85%; font-style: italic; font-weight: bold;"&gt;Note:&lt;/span&gt;&lt;span style="font-size: 85%; font-style: italic;"&gt; I used Adobe Illustrator to create the image above, to help me think, but when using gradient fill in Illustrator some colors take up more space than others. At least it looks like that if you space them evenly. I don't know if this also is the case with my color mixer, but I haven't really bothered to figure that out. &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;At first I used alot of steps before I realized I could remove some of them. Orange for example is produced when you have more red than green on your way to yellow (full red and full green). But purple requires both full red and full blue. Hence some I could remove some steps and had to keep some of them.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-weight: bold;"&gt;&lt;span class="Apple-style-span"&gt;Videos&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: center;"&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/4mQDPiiOCUY&amp;hl=sv&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/4mQDPiiOCUY&amp;hl=sv&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-weight: bold;"&gt;Button presses in the video &lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-style: italic;"&gt;&lt;span class="Apple-style-span"&gt;Filmed in broad daylight, hence the colors don't really come out too well.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 100%;"&gt;1. On - Select a color with the color selector.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 100%;"&gt;2. Pulse - Pulsate the selected color.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 100%;"&gt;3. Random/Cycle -  Cycle randomly through the palette. &lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 100%;"&gt;4. Off.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: center;"&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/SufOPGnJ8gI&amp;hl=sv&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/SufOPGnJ8gI&amp;hl=sv&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-weight: bold;"&gt;Pulse Mode &lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-style: italic;"&gt;&lt;span class="Apple-style-span"&gt;Filmed in a dark room with the RGB-strip hidden behind the laptop screen.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;object height="344" width="425"&gt;&lt;param name="movie" value="http://www.youtube.com/v/K4fclKRvlW8&amp;hl=sv&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/K4fclKRvlW8&amp;hl=sv&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-weight: bold;"&gt; Random/Cycle Mode&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-style: italic;"&gt;&lt;span class="Apple-style-span"&gt;Filmed in a dark room with the RGB-strip hidden behind the laptop screen.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: 100%; font-weight: bold;"&gt;Source code&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-size: medium;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;UPDATE:&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;New source code and videos&amp;nbsp;&lt;a href="http://genericnerd.blogspot.com/2011/12/arduino-mood-light-controller-v3.html"&gt;here.&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;The finished code with four modes, also available as a &lt;a href="http://www.markusulfberg.se/slask/arduino/rgb_mixer_controlled_pulse_makkan.pde"&gt;download here&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;Formatted for Blogger with: &lt;a href="http://formatmysourcecode.blogspot.com/"&gt;formatmysourcecode.blogspot.com&lt;/a&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 100%;"&gt;&lt;code&gt;/*&lt;br /&gt;RGB LED controller&lt;br /&gt;4 modes: off, color select, color pulse and random cycle/pulse&lt;br /&gt;By Markus Ulfberg 2009-05-19&lt;br /&gt;&lt;br /&gt;Thanks to: Ladyada, Tom Igoe and&lt;br /&gt;everyone at the Arduino forum for excellent&lt;br /&gt;tutorials and everyday help.&lt;br /&gt;&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;// set the ledPins&lt;br /&gt;int ledRed = 10;&lt;br /&gt;int ledGreen = 9;&lt;br /&gt;int ledBlue = 11;&lt;br /&gt;&lt;br /&gt;// color selector pin&lt;br /&gt;int potPin = 1;&lt;br /&gt;&lt;br /&gt;// lightMode selector&lt;br /&gt;int switchPin = 2;&lt;br /&gt;&lt;br /&gt;// light mode variable&lt;br /&gt;// initial value 0 = off&lt;br /&gt;int lightMode = 0;&lt;br /&gt;&lt;br /&gt;// LED Power variables&lt;br /&gt;byte redPwr = 0;&lt;br /&gt;byte greenPwr = 0;&lt;br /&gt;byte bluePwr = 0;&lt;br /&gt;&lt;br /&gt;// Variables for lightMode 2&lt;br /&gt;// variables for keeping pulse color&lt;br /&gt;byte redPulse;&lt;br /&gt;byte greenPulse;&lt;br /&gt;byte bluePulse;&lt;br /&gt;&lt;br /&gt;// Set pulse to down initially&lt;br /&gt;byte pulse = 0;&lt;br /&gt;&lt;br /&gt;// floating variables needed to be able to pulse a fixed color&lt;br /&gt;float redFloat;&lt;br /&gt;float greenFloat;&lt;br /&gt;float blueFloat;&lt;br /&gt;&lt;br /&gt;// the amount R,G &amp;amp; B should step up/down to display an fixed color&lt;br /&gt;float redKoff;&lt;br /&gt;float greenKoff;&lt;br /&gt;float blueKoff;&lt;br /&gt;&lt;br /&gt;// Variables for lightMode 3&lt;br /&gt;// set the initial random colors&lt;br /&gt;byte redNew = random(255);&lt;br /&gt;byte greenNew = random(255);&lt;br /&gt;byte blueNew = random(255);&lt;br /&gt;&lt;br /&gt;// misc interface variables&lt;br /&gt;// potVal keeps the value of the potentiometer&lt;br /&gt;int potVal;&lt;br /&gt;// value from the button (debounce)&lt;br /&gt;int switchVal;&lt;br /&gt;int switchVal2;&lt;br /&gt;// buttonState registers if the button has changed&lt;br /&gt;int buttonState;&lt;br /&gt;&lt;br /&gt;void setup()&lt;br /&gt;{&lt;br /&gt;pinMode(ledRed, OUTPUT);&lt;br /&gt;pinMode(ledGreen, OUTPUT);&lt;br /&gt;pinMode(ledBlue, OUTPUT);&lt;br /&gt;&lt;br /&gt;pinMode(potPin, INPUT);&lt;br /&gt;&lt;br /&gt;pinMode(switchPin, INPUT);&lt;br /&gt;buttonState = digitalRead(switchPin);&lt;br /&gt;&lt;br /&gt;// serial for debugging purposes only&lt;br /&gt;Serial.begin(9600);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void loop()&lt;br /&gt;{&lt;br /&gt;switchVal = digitalRead(switchPin);      // read input value and store it in val&lt;br /&gt;delay(10);                         // 10 milliseconds is a good amount of time&lt;br /&gt;switchVal2 = digitalRead(switchPin);     // read the input again to check for bounces&lt;br /&gt;if (switchVal == switchVal2) {                 // make sure we got 2 consistant readings!&lt;br /&gt;if (switchVal != buttonState) {          // the button state has changed!&lt;br /&gt;if (switchVal == LOW) {                // check if the button is pressed&lt;br /&gt;if (lightMode == 0) {          // light is off&lt;br /&gt;lightMode = 1;             // light is on and responds to pot&lt;br /&gt;} else {&lt;br /&gt;if (lightMode == 1) {&lt;br /&gt;lightMode = 2;           // light pulsates in the latest color from pot&lt;br /&gt;} else {&lt;br /&gt;if (lightMode == 2) {&lt;br /&gt;lightMode = 3;           // light changes randomly&lt;br /&gt;} else {&lt;br /&gt;lightMode = 0;             // light is off &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;buttonState = switchVal;                 // save the new state in our variable&lt;br /&gt;}&lt;br /&gt;if (lightMode == 0) {      // turn light off&lt;br /&gt;analogWrite(ledRed, 0);&lt;br /&gt;analogWrite(ledGreen, 0);&lt;br /&gt;analogWrite(ledBlue, 0);&lt;br /&gt;}&lt;br /&gt;if (lightMode == 1) {        // set fixed color&lt;br /&gt;&lt;br /&gt;// read the potentiometer position&lt;br /&gt;potVal = analogRead(potPin);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// RED &amp;gt; ORANGE &amp;gt; YELLOW&lt;br /&gt;if (potVal &amp;gt; 0 &amp;amp;&amp;amp; potVal &amp;lt; 170) {&lt;br /&gt;redPwr = 255;&lt;br /&gt;bluePwr = 0;&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;greenPwr = map(potVal, 0, 170, 0, 255);&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// YELLOW &amp;gt; LIME?? &amp;gt; GREEN&lt;br /&gt;if (potVal &amp;gt; 170 &amp;amp;&amp;amp; potVal &amp;lt; 341) {&lt;br /&gt;greenPwr = 255;&lt;br /&gt;bluePwr = 0;&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;redPwr = map(potVal, 341, 170, 0, 255);&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// GREEN &amp;gt; TURQOUISE&lt;br /&gt;if (potVal &amp;gt; 341 &amp;amp;&amp;amp; potVal &amp;lt; 511) {&lt;br /&gt;greenPwr = 255;&lt;br /&gt;redPwr = 0;&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;bluePwr = map(potVal, 341, 511, 0, 255);&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// TURQOUISE &amp;gt; BLUE&lt;br /&gt;if (potVal &amp;gt; 511 &amp;amp;&amp;amp; potVal &amp;lt; 682) {&lt;br /&gt;bluePwr = 255;&lt;br /&gt;redPwr = 0;&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;greenPwr = map(potVal, 682, 511, 0, 255);&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// BLUE &amp;gt; PURPLE&lt;br /&gt;if (potVal &amp;gt; 682 &amp;amp;&amp;amp; potVal &amp;lt; 852) {&lt;br /&gt;bluePwr = 255;&lt;br /&gt;greenPwr = 0;&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;redPwr = map(potVal, 682, 852, 0, 255);&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// PURPLE &amp;gt; RED&lt;br /&gt;if (potVal &amp;gt; 852 &amp;amp;&amp;amp; potVal &amp;lt; 1023) {&lt;br /&gt;redPwr = 255;&lt;br /&gt;greenPwr = 0;&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;bluePwr = map(potVal, 1023, 852, 0, 255);&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;}&lt;br /&gt;redFloat = float(redPwr);&lt;br /&gt;greenFloat = float(greenPwr);&lt;br /&gt;blueFloat = float(bluePwr);&lt;br /&gt;&lt;br /&gt;redKoff = redFloat / 255;&lt;br /&gt;greenKoff = greenFloat / 255;&lt;br /&gt;blueKoff = blueFloat / 255;&lt;br /&gt;&lt;br /&gt;redPulse = redPwr;&lt;br /&gt;greenPulse = greenPwr;&lt;br /&gt;bluePulse = bluePwr;&lt;br /&gt;&lt;br /&gt;/*&lt;br /&gt;// Debug&lt;br /&gt;Serial.print("redFLoat: ");&lt;br /&gt;Serial.print(redFloat, DEC);&lt;br /&gt;Serial.print(" redPwr: ");&lt;br /&gt;Serial.print(redPwr, DEC);&lt;br /&gt;Serial.print(" greenFloat: ");&lt;br /&gt;Serial.print(greenFloat, DEC);&lt;br /&gt;Serial.print(" greenPwr: ");&lt;br /&gt;Serial.print(greenPwr, DEC);&lt;br /&gt;Serial.print(" blueFloat: ");&lt;br /&gt;Serial.print(blueFloat, DEC);&lt;br /&gt;Serial.print(" bluePwr: ");&lt;br /&gt;Serial.println(bluePwr, DEC);&lt;br /&gt;// End debug&lt;br /&gt;*/&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (lightMode == 2) {     // pulse fixed color&lt;br /&gt;&lt;br /&gt;// display the colors&lt;br /&gt;analogWrite(ledRed, redFloat);&lt;br /&gt;analogWrite(ledGreen, greenFloat);&lt;br /&gt;analogWrite(ledBlue, blueFloat);&lt;br /&gt;&lt;br /&gt;// add delay here for speed control&lt;br /&gt;delay(5);&lt;br /&gt;&lt;br /&gt;// pulse down&lt;br /&gt;if (pulse == 0) {&lt;br /&gt;if (redFloat &amp;gt; 10) {&lt;br /&gt;redFloat = redFloat - redKoff;&lt;br /&gt;}&lt;br /&gt;if (greenFloat &amp;gt; 10) {&lt;br /&gt;greenFloat = greenFloat - greenKoff;&lt;br /&gt;}&lt;br /&gt;if (blueFloat &amp;gt; 10) {&lt;br /&gt;blueFloat = blueFloat - blueKoff;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// If all xFloat match 10 get pulse up&lt;br /&gt;if (byte(redFloat) &amp;lt;= 10) {&lt;br /&gt;if (byte(greenFloat) &amp;lt;= 10) {&lt;br /&gt;if (byte(blueFloat) &amp;lt;= 10) {&lt;br /&gt;pulse = 1;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;// Pulse up&lt;br /&gt;if (pulse == 1) {&lt;br /&gt;if (redFloat &amp;lt; redPulse) {&lt;br /&gt;redFloat = redFloat + redKoff;&lt;br /&gt;}&lt;br /&gt;if (greenFloat &amp;lt; greenPulse) {&lt;br /&gt;greenFloat = greenFloat + greenKoff;&lt;br /&gt;}&lt;br /&gt;if (blueFloat &amp;lt; bluePulse) {&lt;br /&gt;blueFloat = blueFloat + blueKoff;&lt;br /&gt;}&lt;br /&gt;// If all Pwr match Pulse get pulse down&lt;br /&gt;&lt;br /&gt;if (byte(redFloat) == redPulse) {&lt;br /&gt;if (byte(greenFloat) == greenPulse) {&lt;br /&gt;if (byte(blueFloat) == bluePulse) {&lt;br /&gt;pulse = 0;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/*&lt;br /&gt;// Debug&lt;br /&gt;Serial.print("redFloat: ");&lt;br /&gt;Serial.print(redFloat, DEC);&lt;br /&gt;Serial.print(" redPulse: ");&lt;br /&gt;Serial.print(redPulse, DEC);&lt;br /&gt;Serial.print(" greenFloat: ");&lt;br /&gt;Serial.print(greenFloat, DEC);&lt;br /&gt;Serial.print(" greenPulse: ");&lt;br /&gt;Serial.print(greenPulse, DEC);&lt;br /&gt;Serial.print(" blueFloat: ");&lt;br /&gt;Serial.print(blueFloat, DEC);&lt;br /&gt;Serial.print(" bluePulse: ");&lt;br /&gt;Serial.print(bluePulse, DEC);&lt;br /&gt;Serial.print(" pulse: ");&lt;br /&gt;Serial.println(pulse, DEC);&lt;br /&gt;// End debug&lt;br /&gt;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (lightMode == 3) {  // randomsize colorNew and step colorPwr to it&lt;br /&gt;if (redPwr &amp;gt; redNew) {&lt;br /&gt;redPwr--;&lt;br /&gt;}&lt;br /&gt;if (redPwr &amp;lt; redNew) {&lt;br /&gt;redPwr++;&lt;br /&gt;}&lt;br /&gt;if (greenPwr &amp;gt; greenNew) {&lt;br /&gt;greenPwr--;&lt;br /&gt;}&lt;br /&gt;if (greenPwr &amp;lt; greenNew) {&lt;br /&gt;greenPwr++;&lt;br /&gt;}&lt;br /&gt;if (bluePwr &amp;gt; blueNew) {&lt;br /&gt;bluePwr--;&lt;br /&gt;}&lt;br /&gt;if (bluePwr &amp;lt; blueNew) {&lt;br /&gt;bluePwr++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// If all Pwr match New get new colors&lt;br /&gt;&lt;br /&gt;if (redPwr == redNew) {&lt;br /&gt;if (greenPwr == greenNew) {&lt;br /&gt;if (bluePwr == blueNew) {&lt;br /&gt;redNew = random(254);&lt;br /&gt;greenNew = random(254);&lt;br /&gt;blueNew = random(254);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// display the colors&lt;br /&gt;analogWrite(ledRed, redPwr);&lt;br /&gt;analogWrite(ledGreen, greenPwr);&lt;br /&gt;analogWrite(ledBlue, bluePwr);&lt;br /&gt;delay(20);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-5898307638678122032?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='video/mp4' href='http://www.blogger.com/video-play.mp4?contentId=4b2be5b467ab02b3&amp;type=video%2Fmp4' length='0'/><link rel='enclosure' type='video/mp4' href='http://www.blogger.com/video-play.mp4?contentId=b20c64f2869b3b33&amp;type=video%2Fmp4' length='0'/><link rel='enclosure' type='video/mp4' href='http://www.blogger.com/video-play.mp4?contentId=fb26c310d9495bc1&amp;type=video%2Fmp4' length='0'/><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/5898307638678122032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/05/arduino-mood-light-controller.html#comment-form' title='65 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5898307638678122032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5898307638678122032'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/05/arduino-mood-light-controller.html' title='Arduino Mood light controller'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_3utbOaMVL14/ShKRhyg4rhI/AAAAAAAAAr0/L0-l_pTI6wY/s72-c/layout_RGBstrip.png' height='72' width='72'/><thr:total>65</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-5688032710788586282</id><published>2009-05-18T13:14:00.000+02:00</published><updated>2009-05-18T13:14:00.945+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OSX'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Emulation'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital picture frame'/><title type='text'>Backing up a system on Compact Flash</title><content type='html'>&lt;div&gt;If you have a system on Compact Flash, for instance &lt;a href="http://genericnerd.blogspot.com/2009/05/converting-toshiba-320cds-to-digital.html"&gt;a digital picture frame&lt;/a&gt;. There's a really neat way to work on the system without having to write to the disk more than once, and still do alot of updates or other changes.&lt;br /&gt;&lt;br /&gt;What you do is that you make a disk image of the Compact Flash media and then run that image in a machine emulator like &lt;a href="http://www.nongnu.org/qemu/"&gt;Qemu&lt;/a&gt; for Linux and Windows or &lt;a href="http://www.kju-app.org/"&gt;Q - [kju:]&lt;/a&gt; for OSX. Once the image is booted you can, work on the system and do all sorts of changes and when you're done all you have to do is write that image back to the media it came from.  Ofcourse, if you're only doing minor changes this might be unecessary but for bigger system updates or just testing out new software before going live it's really nice.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How it's done&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Hook up your CF-card to your host system make sure the disk is not mounted, unmount it if necessary. But before doing that find out the path to the disk i.e: &lt;span style="font-style: italic;"&gt;/dev/sdb, /dev/hdb or something like that.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Then run dd to copy the whole disk to an image. &lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Warning!&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;The dd command can cause irreversible damage to your system. If you're not sure what you're doing, don't do it.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Syntax: dd if=path_to_disk_to_backup of=outfile&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Where &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;if&lt;/span&gt;&lt;span style="font-style: italic;"&gt; stands for "Input file" and &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;of&lt;/span&gt;&lt;span style="font-style: italic;"&gt; for "Output file"&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;For my system I use the following command:&lt;/span&gt;&lt;br /&gt;dd if=/dev/sdb of=lappy586.bin conv=noerror,sync&lt;span style="font-style: italic;"&gt;&lt;br /&gt;The added option &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;conv=noerror,sync &lt;/span&gt;&lt;span style="font-style: italic;"&gt;makes sure that the copy will go on even if there are errors.&lt;/span&gt;&lt;br /&gt;The copy might take a while depending on the size of the image you try to copy.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;After the copy is done you can run the image with qemu like this: &lt;/span&gt;&lt;br /&gt;qemu -hda path_to_diskimage&lt;br /&gt;&lt;br /&gt;Qemu has alot of options, if things don't work out for you the first time have a look at the manpages and other documentation. I got lucky and had everything working without any need for extra configuration when running Qemu from Debian but not so lucky when trying to run the same image from Windows Vista.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Finally, to write the backup back to disk just reverse the paths in the dd command&lt;/span&gt;:&lt;br /&gt;dd if=lappy586.bin of=/dev/sdb conv=noerror,sync&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-5688032710788586282?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/5688032710788586282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/05/backing-up-system-on-compact-flash.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5688032710788586282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/5688032710788586282'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/05/backing-up-system-on-compact-flash.html' title='Backing up a system on Compact Flash'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-8683182103226410159</id><published>2009-05-15T11:18:00.000+02:00</published><updated>2009-05-15T11:18:01.232+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='List'/><category scheme='http://www.blogger.com/atom/ns#' term='Electronics'/><category scheme='http://www.blogger.com/atom/ns#' term='Arduino'/><title type='text'>Useful parts to keep in stock</title><content type='html'>&lt;span style="color: rgb(0, 0, 0);"&gt;I thought I'd put together a little list of parts one might need when starting to fiddle with the Arduino and electronics in general. Why, well I would have liked one when I started out. It would have saved me alot on unnecessary shipping.&lt;br /&gt;The list is partly my own,  borrowing some from &lt;a href="http://tigoe.net/"&gt;Tom Igoes&lt;/a&gt; &lt;a href="http://oreilly.com/catalog/9780596510510/"&gt;Making Things Talk&lt;/a&gt; (a book I highly recommend) and a thread over at the &lt;a href="http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231849544/"&gt;Arduino forum&lt;/a&gt; I started.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Bread boards:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0); font-style: italic;"&gt;I thought I would only need one or two. By experience I know better and if you're like me, working on multiple projects, it's nice to have a few. It saves you the trouble of deconstructing and reconstructing half baked projects.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 0);"&gt;Jumper wire:&lt;/span&gt; &lt;span style="font-style: italic; color: rgb(0, 0, 0);"&gt;For the breadboard. There are alot of different models. I've used solid core wires that were labeled for use with bread boards.  I don't really care for them, however I don't have any other recommendations.&lt;/span&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;DC adaptor:&lt;/b&gt;  &lt;span style="color: rgb(0, 0, 0); font-style: italic;"&gt;The Arduino uses a 2.1 mm center positive plug. However since you never know what you might need it's quite good to get one with interchangeable plugs in different sizes. &lt;/span&gt; &lt;span style="color: rgb(0, 0, 0); font-style: italic;"&gt;Preferably with variable voltage aswell. &lt;/span&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;br /&gt;Connectors:&lt;/b&gt; &lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;DC 2.1 mm jack&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Useful when using a separate power source to your projects.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;DC 2.1 mm plug&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Useful when powering from battery. &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;9V battery connector&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Same reason as above but for the other end. &lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Headers female and male.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Alot of different uses. Especially when it comes to connecting wires to a breadboard.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;Resistors:&lt;/b&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;/span&gt;&lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;100 Ohm&lt;br /&gt;&lt;/li&gt;&lt;li&gt;220 Ohm&lt;/li&gt;&lt;li&gt;470 Ohm&lt;/li&gt;&lt;li&gt;1 k Ohm&lt;/li&gt;&lt;li&gt;4.7 k Ohm&lt;/li&gt;&lt;li&gt;10 k Ohm&lt;/li&gt;&lt;li&gt;22 k Ohm&lt;/li&gt;&lt;li&gt;100 k Ohm&lt;/li&gt;&lt;li&gt;1 M Ohm&lt;/li&gt;&lt;/ol&gt; &lt;span style="font-weight: bold; color: rgb(0, 0, 0);"&gt;&lt;br /&gt;Variable&lt;/span&gt;&lt;b style="color: rgb(0, 0, 0);"&gt; resistors:&lt;br /&gt;&lt;/b&gt;&lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;CdS resistor: 2-5 k Ohm&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Works as a light sensor if you hook it up to your micro controller of choice.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;NTC resistor: 4700 Ohm &lt;span style="font-style: italic;"&gt;&lt;br /&gt;A.K.A. thermistor, like the above but senses heat instead.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Potentiometer: 10 k Ohm&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Extremely useful when working with micro controllers.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;Capacitors: &lt;/b&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;0.1 uF ceramic&lt;span style="font-style: italic;"&gt; (sometimes labled as 100 nF)&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;1 uF electrolyte &lt;/li&gt;&lt;li&gt;47 uF electrolyte&lt;/li&gt;&lt;li&gt;10 uF electrolyte&lt;/li&gt;&lt;li&gt;100 uF electrolyte&lt;/li&gt;&lt;/ol&gt; &lt;span style="font-weight: bold; color: rgb(0, 0, 0);"&gt;&lt;br /&gt;ICs: &lt;/span&gt; &lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;&lt;b&gt;H-bridge:&lt;/b&gt; L293D&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Useful for controlling DC motors and stepper motors. Allows you to switch polarity of the outputs.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Darlington array: &lt;/b&gt;ULN2003&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Useful for controlling bigger loads such as stepper motors and LED-strips.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;Transistors: &lt;/b&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;These are pretty much generic transistors that my supplier had in stock. If you can't find a specific transistor, just swap it out for one with similar specs. &lt;/span&gt; &lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;2N2222A TO-92 NPN 40V 800mA 300MHz&lt;br /&gt;&lt;/li&gt;&lt;li&gt;BC547B TO-92 NPN 45V 0.1A&lt;br /&gt;&lt;/li&gt;&lt;li&gt;BC557B TO-92 PNP 50V 0.1A&lt;/li&gt;&lt;li&gt;TIP120 TO-220 NPN Darlington 60V 5A&lt;/li&gt;&lt;li&gt;IRF540 TO-220 N-ch MOSFET 100V 28A&lt;/li&gt;&lt;li&gt;&lt;div class="prodimg"&gt;2N3906 TO-92 PNP 40V 200mA&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;LEDs:&lt;br /&gt;&lt;/b&gt;&lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;Red 5 mm dim&lt;br /&gt;&lt;span style="font-style: italic;"&gt;The most basic of LEDs.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Red 5 mm clear super bright&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Together with the green and blue below it's what you need to do color mixing.&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Green 5 mm clear super bright&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Blue 5 mm clear super bright&lt;/li&gt;&lt;/ol&gt; &lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;Diodes:&lt;/b&gt; &lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;1N4004 DO-41 400V 1A&lt;/li&gt;&lt;li&gt;Zener BZX55C3V3 DO-35 3.3V&lt;/li&gt;&lt;/ol&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;Voltage regulator:&lt;br /&gt;&lt;/b&gt;&lt;ol style="color: rgb(0, 0, 0);"&gt;&lt;li&gt;LM317T TO-220&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Variable voltage regulator, with two resistors you can  get output voltages from 1.2 V to 37 V.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-8683182103226410159?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/8683182103226410159/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/05/useful-parts-to-keep-in-stock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/8683182103226410159'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/8683182103226410159'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/05/useful-parts-to-keep-in-stock.html' title='Useful parts to keep in stock'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-7088504033423577475</id><published>2009-05-13T22:24:00.004+02:00</published><updated>2009-05-14T13:57:04.591+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Script'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='email'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet'/><title type='text'>Automated notification of updated of external IP</title><content type='html'>For my DSL line I get a dynamic IP address. On the inside it's quite easy to find out what the external IP is, but on the outside damn near impossible to find out what the IP might have changed to.&lt;br /&gt;To get around that problem I wrote a little script that checks the external IP and sends me an e-mail if there has been any changes.&lt;br /&gt;&lt;br /&gt;The script uses html2text and ssmtp.&lt;br /&gt;Unfortunately blogger doesn't handle tab intendentions very well. But if your really want those identations, you can download the &lt;a href="http://www.markusulfberg.se/slask/ipquery.sh"&gt;script here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;#!/bin/sh&lt;br /&gt;&lt;br /&gt;# ipquery.sh&lt;br /&gt;# IP checker and updater by Markus Ulfberg 2009-05-12&lt;br /&gt;&lt;br /&gt;# Variables&lt;br /&gt;# Path where ip.txt resides or will be created if it doesen't exist already&lt;br /&gt;DIR=your_path_here&lt;your_path_here&gt;&lt;br /&gt;# E-mail address, both from and to&lt;br /&gt;ADDRESS=your_email_address_here&lt;your_email_address_here&gt;&lt;br /&gt;# E-mail Subject&lt;br /&gt;SUBJECT="New IP-number"&lt;br /&gt;# update interval in minutes&lt;br /&gt;UPDATE_INTERVAL=15&lt;br /&gt;&lt;br /&gt;# Check for ip.txt and create if it doesn't exist.&lt;br /&gt;if [ ! -s $DIR/ip.txt ]&lt;br /&gt;then&lt;br /&gt;   # Create ip.txt&lt;br /&gt;   echo "ip.txt doesn't exist. Creating ip.txt ..."&lt;br /&gt;   echo "0.0.0.0" &gt; $DIR/ip.txt&lt;br /&gt;else&lt;br /&gt;   echo "ip.txt exists. Continuing ..."&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;# Loop&lt;br /&gt;while [ 1 ]&lt;br /&gt;do&lt;br /&gt;# Get current IP&lt;br /&gt;currentIP=`html2text http://checkip.dyndns.org | grep Current | awk '{print$4}'`&lt;br /&gt;echo "Current IP: $IP"&lt;br /&gt;&lt;br /&gt;# Read old IP from file&lt;br /&gt;oldIP=`cat $DIR/ip.txt`&lt;br /&gt;echo "Old IP: $oldIP"&lt;br /&gt;&lt;br /&gt;# Compare current and old IP&lt;br /&gt;if [ $oldIP != $currentIP ]&lt;br /&gt;   then&lt;br /&gt;       echo "IP has changed to: $currentIP"&lt;br /&gt;       # Write new IP to ip.txt&lt;br /&gt;       echo $currentIP &gt; $DIR/ip.txt&lt;br /&gt;       # Set e-mail content to new IP&lt;br /&gt;       CONTENT=$currentIP&lt;br /&gt;       # Send the e-mail notification&lt;br /&gt;       echo -e "FROM:$ADDRESS\nTO:$ADDRESS\nSUBJECT:$SUBJECT\nContent-type:text/plain\n$CONTENT\n" | `/usr/sbin/ssmtp $ADDRESS`&lt;br /&gt;   else&lt;br /&gt;       echo "IP is still: $currentIP"&lt;br /&gt;   fi&lt;br /&gt;# Wait before running the loop again&lt;br /&gt;sleep "$UPDATE_INTERVAL"m&lt;br /&gt;done&lt;br /&gt;&lt;/your_email_address_here&gt;&lt;/your_path_here&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-7088504033423577475?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/7088504033423577475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/05/automated-notification-of-updated-of.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/7088504033423577475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/7088504033423577475'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/05/automated-notification-of-updated-of.html' title='Automated notification of updated of external IP'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-3906930371043164473</id><published>2009-05-09T07:37:00.000+02:00</published><updated>2009-05-09T11:03:37.334+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Digital picture frame'/><category scheme='http://www.blogger.com/atom/ns#' term='Toshiba 320CDS'/><title type='text'>Converting the Toshiba 320CDS to a digital picture frame</title><content type='html'>&lt;div style="margin: 0px auto 10px; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_3utbOaMVL14/SgVGL3N4PpI/AAAAAAAAAqw/mS0yFMxubBk/s1600-h/IMG_2836.JPG"&gt;&lt;img alt="" src="http://3.bp.blogspot.com/_3utbOaMVL14/SgVGL3N4PpI/AAAAAAAAAqw/mS0yFMxubBk/s320/IMG_2836.JPG" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;Inspired by the many digital picture frame tutorials online I decided to make one myself.&lt;br /&gt;First I jotted down some goals:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Use a minimal amount of hardware and achive total silence.&lt;/span&gt;&lt;br /&gt;Solution: Strip away, speakers, battery, CD- and floppy drive. Instead of the hard drive use a Compact Flash card with a CF-IDE bridge.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Use a minimal amount of wires. &lt;/span&gt;&lt;br /&gt;Solution: Use wireless networking.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Design with a thin and flat formfactor.&lt;/span&gt;&lt;br /&gt;Solution: Mount everything between two sheets of transparent polycarbonate or acrylic glass (plexi glass).&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Run without keyboard or mouse.&lt;/span&gt;&lt;br /&gt;Solution: Remote control via ssh and/or vnc. &lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Easy power up/down via the power button.&lt;/span&gt;&lt;br /&gt;Solution: Autologin in console and run X and other stuff from .bash_profile&lt;br /&gt;Problem: Since the Toshiba 320CDS uses an APM BIOS it cannot read events on the power button. In other words it cannot power down nicely using the power button. Any ACPI BIOS would be able to.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Display a slide show of images.&lt;/span&gt;&lt;br /&gt;Solution: Use Feh, a very capable lightweight image viewer.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Lenghten the life of the CF card by minimising disk writes/reads after boot.&lt;/span&gt;&lt;br /&gt;Solution: Do not use swap on the CF card, store images online, configure the system to report less.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Display a Pong Clock.&lt;/span&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;&lt;/span&gt;&lt;/b&gt;Solution: Use the pong xscreensaver.&lt;br /&gt;Problem: Won't run smoothly @233 MHz&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Install a minimal debian installation&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span&gt;Follow this excellent tutorial: &lt;/span&gt;&lt;a href="http://wiki.dennyhalim.com/debian-minimal-desktop-installation"&gt;wiki.dennyhalim.com/debian-minimal-desktop-installation&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Additional Debian packages to use&lt;/span&gt;&lt;ul&gt;&lt;li style="background-color: rgb(255, 255, 255);"&gt;Remote control with: ssh and x11vnc&lt;/li&gt;&lt;li style="background-color: rgb(255, 255, 255);"&gt;Disable screen blanking in x: x11-xserver-utils&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Wireless support: wpasupplicant&lt;span style="background-color: rgb(0, 255, 0);"&gt;&lt;span style="background-color: rgb(255, 255, 255);"&gt;&lt;span style="background-color: rgb(0, 255, 0);"&gt;&lt;span style="background-color: rgb(255, 255, 255);"&gt; wireless-tools&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;Image viewer: feh&lt;/li&gt;&lt;li&gt;Remove the mouse cursor: unclutter&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Mount any ftp/sftp/... as local directory: curlftpfs&lt;/li&gt;&lt;/ul&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;Set up wireless networking with 3Com Office Connect 11g PCMCIA&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;ol&gt;&lt;li&gt;Download the correct firmware from: &lt;a href="http://wireless.kernel.org/en/users/Drivers/p54"&gt;prism54.org&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Install the packages wireless-tools and wpasupplicant&lt;/li&gt;&lt;li&gt;Follow this excellent tutorial: &lt;a href="http://ubuntuforums.org/showthread.php?t=318539"&gt;http://ubuntuforums.org/showthread.php?t=318539&lt;/a&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;To use multiple networks, use the following configuration to activate roaming mode:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Edit /etc/network/interfaces:&lt;br /&gt;allow-hotplug wlan0&lt;br /&gt;auto wlan0&lt;br /&gt;iface wlan0 inet manual &lt;span style="font-style: italic;"&gt;# this has to be set to manual, dhcp configuration is done later&lt;/span&gt;&lt;br /&gt;wpa-driver wext&lt;br /&gt;wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf&lt;br /&gt;#id_str="[NAME_OF_NETWORK]&lt;nameofnetwork&gt;"&lt;i&gt; is the identifier that corresponds to the network configuration in wpa_supplicant.conf&lt;/i&gt;&lt;br /&gt;iface &lt;/nameofnetwork&gt;[NAME_OF_NETWORK]&lt;nameofnetwork&gt; &lt;nameofnetwork&gt; inet dhcp&lt;br /&gt;&lt;br /&gt;&lt;/nameofnetwork&gt;&lt;/nameofnetwork&gt;&lt;/li&gt;&lt;li&gt;Create a /etc/wpa_supplicant/wpa_supplicant.conf containing:&lt;br /&gt;ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev&lt;br /&gt;network={&lt;br /&gt;   ssid="[&lt;essid&gt;YOUR_SSID]"&lt;br /&gt;   scan_ssid=1&lt;br /&gt;   psk=[YOUR_PRESHARED_KEY_IN_HEX]&lt;hexkey&gt;&lt;br /&gt;   key_mgmt=WPA-PSK&lt;br /&gt;   pairwise=TKIP&lt;br /&gt;   group=TKIP&lt;br /&gt;   id_str="[NAME_OF_NETWORK]&lt;nameofnetwork&gt;"&lt;br /&gt;}&lt;/nameofnetwork&gt;&lt;/hexkey&gt;&lt;/essid&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;b&gt;&lt;br /&gt;Autologin in debian without starting x first&lt;/b&gt;&lt;br /&gt;Follow one of the two examples here: &lt;a href="http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html"&gt;www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;Starting X after autologin:&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Add startx to .bash_profile&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Set up and use curlftps after autoloing: &lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Add your USER to the group fuse:&lt;br /&gt;sudo adduser USER fuse&lt;br /&gt;For this to activate you have to log in again, the easiest way to do this is:&lt;br /&gt;su USER&lt;/li&gt;&lt;li&gt;Mount your remote directory by adding this line to .bash_profile:&lt;br /&gt;curlftpfs -r -o user=FTPUSERNAME:FTPPASSWORD FTPURL DIRTOMOUNTIN&lt;br /&gt;&lt;/li&gt;&lt;li&gt;If you ever have to unmount the directory you can do this with umount as root or with fusermount -u as a user. &lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Start remove mouse cursor and start slideshow after starting x: &lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Add these lines to ~/.config/openbox/autostart.sh:&lt;br /&gt;unclutter &amp;amp;&lt;br /&gt;feh --full-screen --randomize --auto-zoom --slideshow-delay 10 /home/makkan/images/ &amp;amp;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Disable screen blanking:&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;First of all make sure the bios doesn't blank the screen. &lt;/li&gt;&lt;li&gt;Add these two lines to .bash_profile:&lt;br /&gt;setterm -blank 0&lt;br /&gt;setterm -powersave off&lt;/li&gt;&lt;li&gt;Edit /etc/console-tools/config&lt;br /&gt;Change this line: BLANK_TIME=30&lt;br /&gt;To: BLANK_TIME=0&lt;/li&gt;&lt;li&gt;In your ~/.config/openbox/autostart.sh add these lines:&lt;br /&gt;xset -dpms &amp;amp;&lt;br /&gt;xset s off &amp;amp;&lt;br /&gt;xset s noblank &amp;amp;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Reduce disk writes&lt;br /&gt;&lt;/b&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;If  you have to use swap to get things working set it to minimal use by editing: /etc/sysctl.conf&lt;br /&gt;Add the line: vm.swappiness=0&lt;/li&gt;&lt;li&gt;In /etc/sysctl.conf also activate laptop mode by adding the line:&lt;br /&gt;vm.laptop_mode=5&lt;/li&gt;&lt;li&gt;Activate your new configuration by typing: sudo sysctl -p&lt;/li&gt;&lt;li&gt;Rsyslog writes a MARK every 20:th minute, disable this by editing /etc/default/rsyslog and set:&lt;br /&gt;RSYSLOGD_OPTIONS="-m 0"&lt;br /&gt;Restart rsyslog with:&lt;br /&gt;sudo /etc/init.d/rsyslog restart&lt;/li&gt;&lt;li&gt;Cron writes a report every hour/day/week and so forth. Disable this by editing:&lt;br /&gt;/etc/crontab&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div style="margin: 0px auto 10px; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_3utbOaMVL14/SgVGMKkzmLI/AAAAAAAAAq4/6Nf_74gEEFs/s1600-h/IMG_2837.JPG"&gt;&lt;img alt="" src="http://3.bp.blogspot.com/_3utbOaMVL14/SgVGMKkzmLI/AAAAAAAAAq4/6Nf_74gEEFs/s320/IMG_2837.JPG" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;&lt;div style="margin: 0px auto 10px; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_3utbOaMVL14/SgVGMLrTsYI/AAAAAAAAArA/DgpQ9bWT8Yk/s1600-h/IMG_2838.JPG"&gt;&lt;img alt="" src="http://3.bp.blogspot.com/_3utbOaMVL14/SgVGMLrTsYI/AAAAAAAAArA/DgpQ9bWT8Yk/s320/IMG_2838.JPG" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;br /&gt;&lt;div style="margin: 0px auto 10px; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_3utbOaMVL14/SgVGMY5NqFI/AAAAAAAAArI/kTgQULTY6k8/s1600-h/IMG_2840.JPG"&gt;&lt;img alt="" src="http://2.bp.blogspot.com/_3utbOaMVL14/SgVGMY5NqFI/AAAAAAAAArI/kTgQULTY6k8/s320/IMG_2840.JPG" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div style="clear: both; text-align: center;"&gt;&lt;a href="http://picasa.google.com/blogger/" target="ext"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-3906930371043164473?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/3906930371043164473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/05/converting-toshiba-320cds-to-digital.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/3906930371043164473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/3906930371043164473'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/05/converting-toshiba-320cds-to-digital.html' title='Converting the Toshiba 320CDS to a digital picture frame'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_3utbOaMVL14/SgVGL3N4PpI/AAAAAAAAAqw/mS0yFMxubBk/s72-c/IMG_2836.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-2042516178418440166</id><published>2009-04-13T21:23:00.000+02:00</published><updated>2009-04-13T12:24:00.012+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux'/><category scheme='http://www.blogger.com/atom/ns#' term='Toshiba 320CDS'/><title type='text'>Installing Linux on a Toshiba Satellite 320CDS</title><content type='html'>I've tried a wide range of Linux &lt;a href="http://distrowatch.com/"&gt;distributions&lt;/a&gt; on this old laptop, from &lt;a href="http://www.slackware.com/"&gt;Slackware&lt;/a&gt; to &lt;a href="http://www.ubuntu.com/"&gt;Ubuntu &lt;/a&gt;via &lt;a href="http://damnsmalllinux.org/"&gt;DSL&lt;/a&gt;. But I finally settled with &lt;a href="http://www.debian.org/"&gt;Debian&lt;/a&gt;. I've used Slackware since 3.X and I originally intended to use here aswell. However that was a couple of years ago and I had alot of issues with sound and the wireless. Then Ubuntu came along and sound and wireless worked without any problems at all. But Ubuntu is not really ideal to run on a 233MHz system with only 96 MB RAM. So I tried other variants of Ubuntu like: &lt;a href="http://www.xubuntu.org/"&gt;Xubuntu&lt;/a&gt;, &lt;a href="http://fluxbuntu.org/"&gt;Fluxbuntu &lt;/a&gt;and server installations of Ubuntu. However when I was looking for a good tutorial to do a &lt;a href="http://wiki.dennyhalim.com/ubuntu-minimal-desktop"&gt;minimal installation of Ubuntu&lt;/a&gt; I came across a &lt;a href="http://wiki.dennyhalim.com/debian-minimal-desktop-installation"&gt;good tutorial for Debian&lt;/a&gt; aswell.&lt;br /&gt;&lt;br /&gt;The reason I tried Debian is because I had alot of trouble with Ubuntu dropping out to busybox while booting the installation CD. I temporarily solved that as described below but I got really tired of it aswell.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Load ide-generic on failed boot of an installation CD.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;In busybox type: modprobe ide-generic &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Press: CTRL-D&lt;/span&gt; to continue booting.&lt;br /&gt;&lt;br /&gt;A similar problem might arise during the installation process. Ubuntu will fail to find your CD and ask to scan for it. Before scanning open up another terminal and load the module from there.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Load the ide-generic module on a running system.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Press ALT-FX to open up a free terminal. X= 1-4&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Type: modprobe ide-generic&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Now scan again for the CD.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;On a final note, since this problem will persist until you do something about it. After your first successful boot, before you do anything else.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Load the ide-generic module on boot. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Type: sudo nano /etc/initramfs-tools/modules &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Add the line: ide-generic&lt;br /&gt;Save and quit.&lt;br /&gt;Type: sudo update-initramfs -u&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The above issues does not exist in Debian and like I said before, thats why I ulitmately went with Debian. To do a minimal install with Debian just follow the above link to the tutorial and you're set.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Other stuff worth mentioning.&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Wireless:&lt;/span&gt; 3com Office Connect 11g PCIMCA card.&lt;br /&gt;The card will be detected by the kernel while installing. But it won't start since the firmware is missing. The firmware can be aquired &lt;a href="http://wireless.kernel.org/en/users/Drivers/p54"&gt;here.&lt;/a&gt;&lt;br /&gt;There's a &lt;a href="http://ubuntuforums.org/showthread.php?t=202834"&gt;really good tutorial in the ubuntuforums.org&lt;/a&gt; that describes how to set up a wireless card and have it working with WPA encryption from boot.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Sound:&lt;/span&gt; OPL3-SA2&lt;br /&gt;Just run alsaconf and have it autodetect your soundcard.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Boot options:&lt;/span&gt; acpi=off, noapic, nolapic, vga=788&lt;br /&gt;I use the above line, try to find out whats best for your setup.&lt;br /&gt;&lt;br /&gt;One thing I should mention that might help anyone trying to find out the specs of a Toshiba laptop is that &lt;a href="http://www.csd.toshiba.com/cgi-bin/tais/support/jsp/modelContent.jsp?ct=SB&amp;amp;os=&amp;amp;category=&amp;amp;moid=1073769715&amp;amp;rpn=&amp;amp;modelFilter=320CDS&amp;amp;selCategory=3&amp;amp;selFamily=1073768663"&gt;Toshiba still keeps the support site for ALL their models active&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-2042516178418440166?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/2042516178418440166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/04/installing-linux-on-toshiba-satellite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/2042516178418440166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/2042516178418440166'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/04/installing-linux-on-toshiba-satellite.html' title='Installing Linux on a Toshiba Satellite 320CDS'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-917542905889928199.post-3380902835792491961</id><published>2009-03-18T13:35:00.000+01:00</published><updated>2009-03-18T13:41:03.070+01:00</updated><title type='text'>Bring out the geek!</title><content type='html'>I'm a nerd or a geek I can't really be bothered to make a difference. This place will be my outlet for geekery and perhaps serve as a good place to find information if you ever need to do something I have already done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/917542905889928199-3380902835792491961?l=genericnerd.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://genericnerd.blogspot.com/feeds/3380902835792491961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://genericnerd.blogspot.com/2009/03/bring-out-geek.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/3380902835792491961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/917542905889928199/posts/default/3380902835792491961'/><link rel='alternate' type='text/html' href='http://genericnerd.blogspot.com/2009/03/bring-out-geek.html' title='Bring out the geek!'/><author><name>Markus</name><uri>http://www.blogger.com/profile/06634230781516609525</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://3.bp.blogspot.com/_3utbOaMVL14/SOxSnlTO1PI/AAAAAAAAAgI/Ih_iRDoJaI8/S220/sankt_markus.jpg'/></author><thr:total>0</thr:total></entry></feed>
