- using System;
- using System.Collections;
- using System.Threading;
- using Microsoft.SPOT;
- using Microsoft.SPOT.Presentation;
- using Microsoft.SPOT.Presentation.Controls;
- using Microsoft.SPOT.Presentation.Media;
- using Microsoft.SPOT.Touch;
- using Gadgeteer.Networking;
- using Gadgeteer.Modules.Gadgeteering;
- using GT = Gadgeteer;
- using GTM = Gadgeteer.Modules;
- using Gadgeteer.Modules.GHIElectronics;
- namespace ThermalPrinterDemo
- {
- public partial class Program
- {
- // This method is run when the mainboard is powered up or reset.
- void ProgramStarted()
- {
- button.ButtonPressed += new Button.ButtonEventHandler(button_ButtonPressed);
- camera.PictureCaptured += new Camera.PictureCapturedEventHandler(camera_PictureCaptured);
- // Configure the printer settings (will vary depending on power supply used)
- // Set a higher heating time and heating interval than the default
- // values in order to achieve a higher printing contrast.
- printer.HeatingTime = 2000; // 2000us
- printer.HeatingInterval = 2000; // 2000us
- printer.HeatingDotsMax = 16; // 64 dots (default)
- // Print "Hello!" in the default font
- printer.Print("Hello!");
- printer.SetReversePrinting(true);
- // Print four blank new lines to finish
- printer.Print("\n\n\n\n");
- Debug.Print("Program Started");
- camera.CurrentPictureResolution = Camera.PictureResolution.Resolution320x240;
- }
- void camera_PictureCaptured(Camera sender, GT.Picture picture)
- {
- printer.Print("\n\n");
- //display.SimpleGraphics.DisplayImage(picture, 0, 0); //display taken image for debugging purposes
- printer.Print(picture.MakeBitmap()); //convert to bitmap and print
- printer.Print("\n\n\n\n");
- }
- void button_ButtonPressed(Button sender, Button.ButtonState state)
- {
- //printer.Print(throwawayBitmap);
- if (camera.CameraReady)
- {
- camera.TakePicture();
- }
- }
- }
- }