Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: callil on Apr 25th, 2012  |  syntax: None  |  size: 2.22 KB  |  hits: 41  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. using System;
  2. using System.Collections;
  3. using System.Threading;
  4. using Microsoft.SPOT;
  5. using Microsoft.SPOT.Presentation;
  6. using Microsoft.SPOT.Presentation.Controls;
  7. using Microsoft.SPOT.Presentation.Media;
  8. using Microsoft.SPOT.Touch;
  9.  
  10. using Gadgeteer.Networking;
  11. using Gadgeteer.Modules.Gadgeteering;
  12. using GT = Gadgeteer;
  13. using GTM = Gadgeteer.Modules;
  14. using Gadgeteer.Modules.GHIElectronics;
  15.  
  16.  
  17. namespace ThermalPrinterDemo
  18. {
  19.     public partial class Program
  20.     {
  21.         // This method is run when the mainboard is powered up or reset.  
  22.         void ProgramStarted()
  23.         {
  24.             button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
  25.             camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
  26.        
  27.             // Configure the printer settings (will vary depending on power supply used)
  28.  
  29.             // Set a higher heating time and heating interval than the default
  30.             // values in order to achieve a higher printing contrast.
  31.             printer.HeatingTime = 2000;     // 2000us
  32.             printer.HeatingInterval = 2000; // 2000us
  33.             printer.HeatingDotsMax = 16;    // 64 dots (default)
  34.            
  35.  
  36.             // Print "Hello!" in the default font
  37.             printer.Print("Hello!");
  38.            
  39.             printer.SetReversePrinting(true);
  40.  
  41.  
  42.             // Print four blank new lines to finish
  43.             printer.Print("\n\n\n\n");
  44.            
  45.             Debug.Print("Program Started");
  46.  
  47.             camera.CurrentPictureResolution = Camera.PictureResolution.Resolution320x240;
  48.  
  49.         }
  50.  
  51.  
  52.         void camera_PictureCaptured(Camera sender, GT.Picture picture)
  53.         {
  54.             printer.Print("\n\n");
  55.           //display.SimpleGraphics.DisplayImage(picture, 0, 0); //display taken image for debugging purposes
  56.             printer.Print(picture.MakeBitmap()); //convert to bitmap and print
  57.             printer.Print("\n\n\n\n");
  58.         }
  59.  
  60.         void button_ButtonPressed(Button sender, Button.ButtonState state)
  61.         {
  62.             //printer.Print(throwawayBitmap);
  63.             if (camera.CameraReady)
  64.             {
  65.              camera.TakePicture();
  66.             }
  67.         }
  68.     }
  69. }