Mysterious Object at Noon

From Wikicliki
Revision as of 08:49, 30 October 2015 by WikiSysop (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

mini thermal receipt printer

online shops

  • coolcomponents have a battersea pickup. email them and should be able to make arrangements within 3-4 hrs sameday.
  • proto-pic is from scotland so no pickup but their standard 1st class delivery is 2 working days which is very decent.
  • alternatives: http://uk.rs-online.com/web/

Working script - truth.ino

/*************************************************************************
  This is an Arduino library for the Adafruit Thermal Printer.
  Pick one up at --> http://www.adafruit.com/products/597
  These printers use TTL serial to communicate, 2 pins are required.

  Adafruit invests time and resources providing this open source code.
  Please support Adafruit and open-source hardware by purchasing products
  from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution.
 *************************************************************************/

// If you're using Arduino 1.0 uncomment the next line:
#include "SoftwareSerial.h"
// If you're using Arduino 23 or earlier, uncomment the next line:
//#include "NewSoftSerial.h"

#include "Adafruit_Thermal.h"
#include "adalogo.h"
#include "adaqrcode.h"
#include <avr/pgmspace.h>

// #include "SD.h"
// #include "SdFat.h"
// #include "SdFatUtil.h"// use functions to print strings from flash memory

int printer_RX_Pin = 5;  // This is the green wire
int printer_TX_Pin = 6;  // This is the yellow wire
Adafruit_Thermal printer(printer_RX_Pin, printer_TX_Pin);


int r;
String myLocation;
String myTime;
String newLocation;
String newTime;

void setup(){
  Serial.begin(19200);
  pinMode(7, OUTPUT); digitalWrite(7, LOW); // To also work w/IoTP printer
  printer.begin();
   
}

void loop() {
   
 randomSeed(analogRead(A0));   
  int r = random(0,44);
  int v = random(0,9);

  char * myLocation[] = { "Nairobi","East Coast Parkway","On a safari","Zouk Club","Cairo","The house at Lengkong Empat","in the dead sea","Thames Foreshore","In school in Dakar","West Bank garden","On a train to Berlin from Leinfelde","Next to AS3 in NUS","Through the sahara desert","The old Tang Dynasty","London","Marina Bay","Cakes and Shakes restaurant","Somewhere unfamiliar to me in West London","Kensington Gore London","Near Gare de lest Paris France","The Roundhouse, Camden","Lengerich Germany","HMV Oxford Street London","Opposite the ACE centre in Seoul","in the poem Prioritise","San Marco Venice","Cafe in Seoul South Korea","Teotihuacan, Mexico","Dresden, Germany","Stoke Newington","Roundhay School Highschool","Heathrow Airport","Leeds","The House at Stamford Hill","Leeds","Along Kingsland Road","Hamburg Rathaus","Haringey Ladder","National Design Centre Singapore","Malta","Chefs Kitchen on Waterloo Street","Under a huge bridge in Newcastle","Overlooking the Marina Bay Skyline","Ealing London UK","St Pauli Hamburg"};
  char * myTime[] = { "On a sunny day","September 2014","Wednesday evening","November 2014","April 2013","January 2015","Friday Evening","Monday Afternoon","May 2012","December 2014","Summer 2014","Friday Evening","Sunny afternoon","March 2007" };
  printer.justify('L');  
  printer.feed(5);
//  printer.println(r);
//  printer.println(v);
  String newLocation = myLocation[r];   
  String newTime =  myTime[v];   
  printer.print("Location: ");
  printer.print(myLocation[r]);
  printer.print("\nTime: ");
  printer.print(myTime[v]);
  printer.println("\nEvent:__________________________\n________________________________");
  printer.feed(8);
  printer.sleep();      // Tell printer to sleep
  printer.wake();       // MUST call wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
  delay(50000);
}