/* ***************************************************************** ** Duckie Tape Box 2.0x ** ** ** ** Arduino Uno R3 ** ** 128x96 BLUE/WHITE LCD ** ** DHT 11 Temperature + Humidity ** ** DS18B20 Temperature ** ** BH1750 Light Sensor ** ** ** ***************************************************************** */ #include #include #include #include #include #include // Define some stuff like pins and whatnot.. #define ONE_WIRE_BUS 2 dht11 DHT11; #define DHT11PIN 4 // DHT11 - Temp/Humidity : Digital 4 : 3.3v OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); // D18B20 - Temp : Digital 2 : 3.3v BH1750FVI LightSensor; // Lightsensor : Analog 3-5 : 3.3v U8GLIB_ST7920_128X64_1X u8g(13, 11, 10); // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = rs = 10 PSB = GND #define sens0 sensors.getTempCByIndex(0) int ledPin3 = 3; // LED White int ledPin5 = 5; // LED Blue int ledPin6 = 6; // LED Red int ledPin9 = 9; // LED Green int analogPin = 0; // Buttons to A0 int buttonState = 0; // variable to store the value read // A bunch of functions...? :D int ledGlow(int ledPin, int fadeValue) { for(int counter = 0; counter < 3; counter++) { // Brightens the LED for(int brightness = 0 ; brightness <= 155; brightness +=5) { analogWrite(ledPin, brightness); delay(fadeValue); } // for END // Dims the LED for(int brightness = 155 ; brightness >= 0; brightness -=5) { analogWrite(ledPin, brightness); delay(fadeValue); } // for END } // for END return 0; } // ledGlow() END // A bunch of stuff to draw on lcd const uint8_t imagesBitmaps[] U8G_PROGMEM = { 0x03, 0xFC, 0x00, // ######## 0x04, 0x02, 0x00, // # # 0x0C, 0x01, 0x00, // ## # 0x08, 0x01, 0x00, // # # 0x08, 0xF9, 0x00, // # ##### # 0x08, 0x01, 0x00, // # # 0x08, 0x3D, 0x00, // # #### # 0x08, 0x01, 0x00, // # # 0x08, 0xF9, 0x00, // # ##### # 0x08, 0x01, 0x00, // # # 0x08, 0x19, 0x00, // # ## # 0x08, 0xF9, 0x00, // # ##### # 0x08, 0x01, 0x00, // # # 0x08, 0x39, 0x00, // # ### # 0x08, 0x01, 0x00, // # # 0x08, 0x01, 0x00, // # # 0x09, 0xE9, 0x00, // # #### # # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x09, 0xF9, 0x00, // # ###### # 0x19, 0xF9, 0x80, // ## ###### ## 0x31, 0xFC, 0x40, // ## ####### # 0x27, 0xFE, 0x40, // # ########## # 0x4F, 0xFF, 0x20, // # ############ # 0x4F, 0xFF, 0x20, // # ############ # 0x9F, 0xF3, 0x90, // # ######### ### # 0x9F, 0xE1, 0x90, // # ######## ## # 0x9F, 0xE1, 0x90, // # ######## ## # 0x9F, 0xFF, 0x90, // # ############## # 0x9F, 0xFF, 0x90, // # ############## # 0x4F, 0xFF, 0x20, // # ############ # 0x4F, 0xFF, 0x20, // # ############ # 0x27, 0xFE, 0x40, // # ########## # 0x31, 0xFC, 0x40, // ## ####### # 0x18, 0x01, 0x80, // ## ## 0x0C, 0x03, 0x00, // ## ## 0x03, 0xFC, 0x00, // ######## }; const uint8_t rook_bitmap[] U8G_PROGMEM = { 0x00, // 00000000 0x55, // 01010101 0x7f, // 01111111 0x3e, // 00111110 0x3e, // 00111110 0x3e, // 00111110 0x3e, // 00111110 0x7f // 01111111 }; void draw(void) { // graphic command to redraw the complete screen //u8g.setFont(u8g_font_unifont); u8g.setFont(u8g_font_osb21); u8g.drawStr( 0, 50, "Hello World!"); u8g.drawBitmapP( 0, 10, 3, 54, imagesBitmaps); } void dallas(void) { u8g.setPrintPos(0,11); u8g.print(sensors.getTempCByIndex(0)); u8g.setPrintPos(0,22); u8g.print(sensors.getTempCByIndex(1)); } void redbutton(void) { // graphic commands to redraw the complete screen should be placed here u8g.setFont(u8g_font_unifont); //u8g.setFont(u8g_font_osb21); u8g.setPrintPos(0,11); //u8g.print(F( "Hello Swuave!")); } void bluebutton(void) { // graphic commands to redraw the complete screen should be placed here u8g.setFont(u8g_font_unifont); //u8g.setFont(u8g_font_osb21); u8g.setPrintPos(0,11); u8g.print(F( "Blue Button")); } void setup() { Serial.begin(9600); u8g.setRot180(); // set SPI backup if required //u8g.setHardwareBackup(u8g_backup_avr_spi); // assign default color value if ( u8g.getMode() == U8G_MODE_R3G3B2 ) { u8g.setColorIndex(255); // white } else if ( u8g.getMode() == U8G_MODE_BW ) { u8g.setColorIndex(1); // pixel on } // pinMode(13, OUTPUT); sensors.begin(); Serial.print(sensors.getDeviceCount(), DEC); LightSensor.begin(); LightSensor.SetAddress(Device_Address_H);//Address 0x5C LightSensor.SetMode(Continuous_H_resolution_Mode); Serial.println("Running..."); /* create characters lcd.createChar(0, temp); lcd.createChar(1, drop); */ } void loop() { //val = analogRead(analogPin); // read the input pin //Serial.println(val); // debug value sensors.requestTemperatures(); // Get temperatures int chk = DHT11.read(DHT11PIN); if (buttonState < 5) { // Main Screen, No Button pressed. u8g.firstPage(); do { draw(); //dallas(); } while( u8g.nextPage() ); ledGlow(9,30); } // Red Button if (buttonState > 80 && buttonState < 95) { u8g.firstPage(); do { redbutton(); } while(u8g.nextPage()); // rebuild the picture after some delay //delay(50); // Repeats RedButtonMenu for some time.. ledGlow(6,30); } // Blue Button if (buttonState > 15 && buttonState < 25) { u8g.firstPage(); do { bluebutton(); } while(u8g.nextPage()); ledGlow(5,30); } // White Button if (buttonState > 5 && buttonState < 9) { u8g.firstPage(); do { redbutton(); } while( u8g.nextPage() ); ledGlow(3,30); } /* ********************************* ** ** ** SERIAL MONITOR OUTPUT ** ** ** ********************************* */ uint16_t lux = LightSensor.GetLightIntensity();// Get Lux value Serial.print("Light: "); Serial.print(lux); Serial.println(" lux"); // DHT11 Serial.print(DHT11.temperature); // DS18B203 Serial.print("INT(0)-->"),Serial.print(sensors.getTempCByIndex(0)),Serial.print("\337C"); Serial.print("EXT(1)-->"),Serial.print(sensors.getTempCByIndex(1)),Serial.print("\337C"); // Button Panel Output Analog0 buttonState = analogRead(analogPin); // read the input pin Serial.println(buttonState); // debug value delay(300); Serial.print(sens0); } Probably not for you..
?

Random Quote:

"We are living in dangerously weird times now. Smart people just shrug and admit they're dazed and confused. The only ones left with any confidence at all are the New Dumb. It is the beginning of the end of our world as we knew it. Doom is the operative ethic."
Hunter S. Thompson

Hello World:

/*
*****************************************************************
** Duckie Tape Box 2.0x                                        **
**                                                             ** 
** Arduino Uno R3                                              **
** 128x96 BLUE/WHITE LCD                                       **
** DHT 11 Temperature + Humidity                               ** 
** DS18B20 Temperature                                         **  
** BH1750 Light Sensor                                         ** 
**                                                             **    
*****************************************************************
*/


#include 
#include 
#include 
#include  
#include  
#include  


// Define some stuff like pins and whatnot..

#define ONE_WIRE_BUS 2
dht11 DHT11;
#define DHT11PIN 4                                 // DHT11 - Temp/Humidity  : Digital 4   : 3.3v 
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);               // D18B20 - Temp  : Digital 2  : 3.3v
BH1750FVI LightSensor;                             // Lightsensor : Analog 3-5  : 3.3v
U8GLIB_ST7920_128X64_1X u8g(13, 11, 10);           // SPI Com: SCK = en = 13, MOSI = rw = 11, CS = rs = 10 PSB = GND

#define sens0  sensors.getTempCByIndex(0)

int ledPin3 = 3;                                   // LED White
int ledPin5 = 5;                                   // LED Blue
int ledPin6 = 6;                                   // LED Red
int ledPin9 = 9;                                   // LED Green
int analogPin = 0;                                 // Buttons to A0
int buttonState = 0;                                // variable to store the value read
      

// A bunch of functions...? :D

int ledGlow(int ledPin, int fadeValue) {
 
  for(int counter = 0; counter < 3; counter++) {
 
        // Brightens the LED
        for(int brightness = 0 ; brightness <= 155; brightness +=5) {
        analogWrite(ledPin, brightness);        
        delay(fadeValue);                            
        } // for END
 
        // Dims the LED
        for(int brightness = 155 ; brightness >= 0; brightness -=5) {
        analogWrite(ledPin, brightness);        
        delay(fadeValue);
        } // for END
 
   } // for END
    return 0;
} // ledGlow() END
      

// A bunch of stuff to draw on lcd


const uint8_t imagesBitmaps[] U8G_PROGMEM =
{
	0x03, 0xFC, 0x00, //       ########      
	0x04, 0x02, 0x00, //      #        #     
	0x0C, 0x01, 0x00, //     ##         #    
	0x08, 0x01, 0x00, //     #          #    
	0x08, 0xF9, 0x00, //     #   #####  #    
	0x08, 0x01, 0x00, //     #          #    
	0x08, 0x3D, 0x00, //     #     #### #    
	0x08, 0x01, 0x00, //     #          #    
	0x08, 0xF9, 0x00, //     #   #####  #    
	0x08, 0x01, 0x00, //     #          #    
	0x08, 0x19, 0x00, //     #      ##  #    
	0x08, 0xF9, 0x00, //     #   #####  #    
	0x08, 0x01, 0x00, //     #          #    
	0x08, 0x39, 0x00, //     #     ###  #    
	0x08, 0x01, 0x00, //     #          #    
	0x08, 0x01, 0x00, //     #          #    
	0x09, 0xE9, 0x00, //     #  #### #  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x09, 0xF9, 0x00, //     #  ######  #    
	0x19, 0xF9, 0x80, //    ##  ######  ##   
	0x31, 0xFC, 0x40, //   ##   #######   #  
	0x27, 0xFE, 0x40, //   #  ##########  #  
	0x4F, 0xFF, 0x20, //  #  ############  # 
	0x4F, 0xFF, 0x20, //  #  ############  # 
	0x9F, 0xF3, 0x90, // #  #########  ###  #
	0x9F, 0xE1, 0x90, // #  ########    ##  #
	0x9F, 0xE1, 0x90, // #  ########    ##  #
	0x9F, 0xFF, 0x90, // #  ##############  #
	0x9F, 0xFF, 0x90, // #  ##############  #
	0x4F, 0xFF, 0x20, //  #  ############  # 
	0x4F, 0xFF, 0x20, //  #  ############  # 
	0x27, 0xFE, 0x40, //   #  ##########  #  
	0x31, 0xFC, 0x40, //   ##   #######   #  
	0x18, 0x01, 0x80, //    ##          ##   
	0x0C, 0x03, 0x00, //     ##        ##    
	0x03, 0xFC, 0x00, //       ########      
};

const uint8_t rook_bitmap[] U8G_PROGMEM = {
  0x00,         // 00000000 
  0x55,         // 01010101
  0x7f,          // 01111111
  0x3e,         // 00111110
  0x3e,         // 00111110 
  0x3e,         // 00111110
  0x3e,         // 00111110 
  0x7f           // 01111111
};


void draw(void) {
  // graphic command to redraw the complete screen  
  //u8g.setFont(u8g_font_unifont);
  u8g.setFont(u8g_font_osb21);
  u8g.drawStr( 0, 50, "Hello World!");
  u8g.drawBitmapP( 0, 10, 3, 54, imagesBitmaps);
   
  
}



void dallas(void) {
 
  
  u8g.setPrintPos(0,11);
  u8g.print(sensors.getTempCByIndex(0));
  u8g.setPrintPos(0,22);
  u8g.print(sensors.getTempCByIndex(1));
  
}

void redbutton(void) {
 
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.setPrintPos(0,11);
  //u8g.print(F( "Hello Swuave!"));
  
}

void bluebutton(void) {
 
   // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  //u8g.setFont(u8g_font_osb21);
  u8g.setPrintPos(0,11);
  u8g.print(F( "Blue Button"));
     
}



  void setup()

  {
  Serial.begin(9600);
    
  u8g.setRot180();
  
  // set SPI backup if required
  //u8g.setHardwareBackup(u8g_backup_avr_spi);

  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }

  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
   
  
 // pinMode(13, OUTPUT); 
  sensors.begin();
  Serial.print(sensors.getDeviceCount(), DEC);
  LightSensor.begin();
  LightSensor.SetAddress(Device_Address_H);//Address 0x5C
  LightSensor.SetMode(Continuous_H_resolution_Mode);
  Serial.println("Running...");
  
 /* create characters
  lcd.createChar(0, temp);
  lcd.createChar(1, drop);
  */
  
  }



   void loop()

  {
    
  //val = analogRead(analogPin);    // read the input pin
  //Serial.println(val);             // debug value
  
  sensors.requestTemperatures(); // Get temperatures
  int chk = DHT11.read(DHT11PIN);
  
 
  
  if (buttonState < 5)
  { 
    // Main Screen, No Button pressed.
  u8g.firstPage();  
  do {
    draw();
   
   
    //dallas();
  } while( u8g.nextPage() );
          ledGlow(9,30);

  } 
 
  
  // Red Button
  
  if (buttonState > 80 && buttonState < 95)
 
     {  
     u8g.firstPage();  
  do {
    redbutton();
      }
      
  while(u8g.nextPage());
  // rebuild the picture after some delay
  //delay(50);
  // Repeats RedButtonMenu for some time..
        ledGlow(6,30);

 
   }
    
   
  // Blue Button
    if (buttonState > 15 && buttonState < 25)  
    {
      
      u8g.firstPage();  
  do {
    bluebutton();
     }
  while(u8g.nextPage());
      ledGlow(5,30);
     }

  // White Button 
  if (buttonState > 5 && buttonState < 9)
    {  
      u8g.firstPage();  
  do {
    redbutton();
      } while( u8g.nextPage() );
      ledGlow(3,30);
 
  }
  
  
  
  /*
  *********************************
  **                             **
  **  SERIAL MONITOR OUTPUT      **
  **                             **
  *********************************
  */
  uint16_t lux = LightSensor.GetLightIntensity();// Get Lux value
  Serial.print("Light: ");
  Serial.print(lux);
  Serial.println(" lux");
  
  // DHT11
  Serial.print(DHT11.temperature);
  
  // DS18B203
  Serial.print("INT(0)-->"),Serial.print(sensors.getTempCByIndex(0)),Serial.print("\337C");
  Serial.print("EXT(1)-->"),Serial.print(sensors.getTempCByIndex(1)),Serial.print("\337C");
   
  // Button Panel Output Analog0 
  buttonState = analogRead(analogPin);    // read the input pin
  Serial.println(buttonState);             // debug value
  delay(300);
  Serial.print(sens0);
  
 }






	

Output to file:

ls -l >> file.txt