i_mozy
Published © Apache-2.0

Automated Tarot Machine

ATM is an Arduino based split flap display which aims to give users a satisfying tarot card reading experience.

IntermediateWork in progressOver 1 day8,244

Things used in this project

Hardware components

Arduino Mega 2560
Arduino Mega 2560
×1
SD card module
×1
Adafruit NEMA 17 stepper motor
×1
Sparkfun easy driver
×1
Adafruit Thermal Printer
×1
SparkFun ATX Power Connector Breakout Kit - 12V/5V (4-pin)
×1
Hall Effect Sensor Module
×1
3-Pin Servo Extension Cords
×1
1/8” brass rod
×1
M3 .5 x 8mm socket cap screws
×4
8-32 nuts
×10
1 inch 8-32 machine screws
×1
1 1/2 inch 8-32 machine screw
×1
#4 brass flat washers
×2
#4-40 brass plated knurled nuts
×2
3/4 inch #4-40 brass machine screws
×1
8mm Zinc alloy self aligning pillow block flange bearing
×1
8 x 3 mm Round Magnet
×1
16 inch x 24 inch x .25 inch white acrylic sheet
×1
Single-Pole Momentary Contact Push-Button Switch
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)
Breadboard, 170 Pin
Breadboard, 170 Pin
65 Pc. Jumper Wire with Tips Assortment, 22 AWG
65 Pc. Jumper Wire with Tips Assortment, 22 AWG
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
Wire Stripper & Cutter, 18-10 AWG / 0.75-4mm² Capacity Wires
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Automated Tarot Machine Baseplate

Baseplate for the ATM where electronics should be mounted

Automated Tarot Machine Crossbar Covers

These keep the brass crossbar from rotating as well as covering the ends

Automated Tarot Machine Cover

This goes over the electronics and it serves as a stand for the split flap unit

Schematics

Circuit Diagram

Code

Automated Tarot Machine Code

Arduino
#include "Adafruit_Thermal.h"
#include <SD.h>
#include <SPI.h>
#include "SoftwareSerial.h"
#include <Adafruit_NeoPixel.h>
#include <Entropy.h>

//Declare pin functions on Redboard
#define stp 2
#define dir 3
#define MS1 4
#define MS2 5
#define EN  6 // stp, dir, MS1, MS2, EN are all for the Easy Driver
#define LED_PIN 7 // Optional, be sure to comment this outt if you aren't going to use LEDS
#define LED_COUNT 24
#define HOME_SENSOR 8 //This is the pin for the hall effect sensor
#define TX_PIN 9 // Arduino transmit YELLOW WIRE labeled RX on printer
#define RX_PIN 10 // Arduino receive GREEN WIRE labeled TX on printer
#define BUTTON_PIN 11 // Only relavent if you wish to operate the machine without the computer attached
#define SD_Pin 53 


Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800); // declare LEDS
SoftwareSerial mySerial(RX_PIN, TX_PIN); // Declare SoftwareSerial obj first
Adafruit_Thermal printer(&mySerial, 48);     // Pass addr to printer constructor
// Then see setup() function regarding serial & printer begin() calls.

//Declare variables for functions
char user_input;
int x;

inline void initSD() {
  pinMode(SD_Pin, OUTPUT);
  if (!SD.begin(SD_Pin)) {
    Serial.println("SD Error");
  } else {
    Serial.println("SD Ok");
  }
}

//****************************************************************************
//****************************************************************************

boolean lastButtonState = HIGH;
unsigned long currentButtonTime = 0, lastButtonTime = 0, ButtonCheckTime = 20;

//****************************************************************************
//****************************************************************************

void setup() {
  initSD(); //Initialize the SD card
  Entropy.initialize(); //Initialize the Entropy library
  pinMode(stp, OUTPUT);
  pinMode(dir, OUTPUT);
  pinMode(MS1, OUTPUT);
  pinMode(MS2, OUTPUT);
  pinMode(EN, OUTPUT); //Set the pinmodes for the easydriver
  pinMode(HOME_SENSOR, INPUT); // Set the pinmode for the hall effect sensor
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  Serial.begin(9600); //Open Serial connection for debugging
  Serial.println("Begin motor control");
  strip.begin();           // INITIALIZE NeoPixel strip object (REQUIRED)
  strip.show();            // Turn OFF all pixels ASAP
  strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
  mySerial.begin(19200);  // Initialize SoftwareSerial
  printer.begin();        // Init printer (same regardless of serial type)

  FindHome(); // Go to the "Top of the deck" at startup
}

//****************************************************************************
//****************************************************************************

void loop(){
  
  currentButtonTime = millis();
  digitalWrite(EN, LOW); //Pull enable pin low to allow motor control

  if ( currentButtonTime - lastButtonTime > ButtonCheckTime ) {
    
    boolean buttonState = digitalRead(BUTTON_PIN);
    
    if (buttonState == LOW && lastButtonState == HIGH) {
      
      PickACard();
      CardOfTheDay();
      colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
      FindHome();
      
  } 
  lastButtonState = buttonState;
 }
  
  while(Serial.available()){
      user_input = Serial.read(); //Read user input and trigger appropriate function
      digitalWrite(EN, LOW); //Pull enable pin low to allow motor control
      if (user_input == '1'){
          Serial.println();
          Serial.print("Your card of the day is... ");
          PickACard();
          CardOfTheDay();
          colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
          FindHome();
          }
      else if (user_input == '2'){
          Serial.println();
          Serial.print("Your past was... ");
          PickACard();
          Past();
          colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
          Reset();
          Serial.print("Your present is... ");
          PickACard();
          Present();
          colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
          Reset();
          Serial.print("Your future will be... ");
          PickACard();
          Future();
          colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
          FindHome();
          }
      else if (user_input == '3'){
          Serial.println();
          Serial.print("Your relationship card is... ");
          PickACard();
          Relationship();
          colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
          FindHome();
          }
      else if (user_input == '4'){
          Serial.println();
          Serial.print("Your vocational card is... ");
          PickACard();
          Vocation();
          colorWipe(strip.Color(0, 0, 0, 0), 0); // OFF
          FindHome();
          }          
         }
        }

//****************************************************************************
//****************************************************************************

void FindHome(){
  digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH); 
  digitalWrite(MS2, HIGH);  //Pull MS1, and MS2 high to set logic to 1/8th microstep resolution
  Serial.println("Searching for home...");
    for(x= 0; x< 500 ; x++)  //Loop forward enough times to stop a false home
  {
    digitalWrite(stp,HIGH); //Trigger one step forward
    delayMicroseconds(1275);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delayMicroseconds(1275);
  }
  while(digitalRead(HOME_SENSOR)){
    digitalWrite(stp,HIGH); //Trigger one step forward
    delayMicroseconds(1275);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delayMicroseconds(1275);
  }
  Serial.println("Home Found");
  Serial.println();
  Serial.println("What type of reading would you like?");
  Serial.println();
  Serial.println("1: Card of the day");
  Serial.println("2: Past, Present, Future");      
  Serial.println("3: Love and relationships");
  Serial.println("4: Career / Vocation");
 }

//****************************************************************************

void Reset(){
  digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH); //Pull MS1, and MS2 high to set logic to 1/8th microstep resolution
  digitalWrite(MS2, HIGH);
    for(x= 0; x< 500 ; x++)  //Loop forward enough times to stop a false home
  {
    digitalWrite(stp,HIGH); //Trigger one step forward
    delayMicroseconds(1275);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delayMicroseconds(1275);
  }
  while(digitalRead(HOME_SENSOR)){
    digitalWrite(stp,HIGH); //Trigger one step forward
    delayMicroseconds(1275);
    digitalWrite(stp,LOW); //Pull step pin low so it can be triggered again
    delayMicroseconds(1275);
  }
} 

//****************************************************************************

void CardOfTheDay(){
  printer.feed(1);
  printer.boldOn();
  printer.justify('C');
  printer.setSize('L');
  printer.upsideDownOn();
  printer.println(F("CARD OF THE DAY"));
  printer.feed(4);
  printer.upsideDownOff();
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

//****************************************************************************

void Past(){
  printer.feed(1);
  printer.boldOn();
  printer.justify('C');
  printer.setSize('L');
  printer.upsideDownOn();
  printer.println(F("PAST"));
  printer.feed(4);
  printer.upsideDownOff();
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

//****************************************************************************

void Present(){
  printer.feed(1);
  printer.boldOn();
  printer.justify('C');
  printer.setSize('L');
  printer.upsideDownOn();
  printer.println(F("PRESENT"));
  printer.feed(4);
  printer.upsideDownOff();
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

//****************************************************************************

void Future(){
  printer.feed(1);
  printer.boldOn();
  printer.justify('C');
  printer.setSize('L');
  printer.upsideDownOn();
  printer.println(F("FUTURE"));
  printer.feed(4);
  printer.upsideDownOff();
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

//****************************************************************************

void Relationship(){
  printer.feed(1);
  printer.boldOn();
  printer.justify('C');
  printer.setSize('M');
  printer.upsideDownOn();
  printer.println(F("RELATIONSHIP CARD"));
  printer.feed(4);
  printer.upsideDownOff();
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

//****************************************************************************

void Vocation(){
  printer.feed(1);
  printer.boldOn();
  printer.justify('C');
  printer.setSize('L');
  printer.upsideDownOn();
  printer.println(F("VOCATION CARD"));
  printer.feed(4);
  printer.upsideDownOff();
  printer.sleep();      // Tell printer to sleep
  delay(3000L);         // Sleep for 3 seconds
  printer.wake();       // MUST wake() before printing again, even if reset
  printer.setDefault(); // Restore printer to defaults
}

//****************************************************************************

void PickACard()
{
  
  int val = 
  
  Entropy.random(40, 1581); // Full range of cards excluding "blanks" #0 & #20
  int rem;
 
  rem = val % 20 ;
  if (rem < 10)
    val -= rem;
  else
    val += 20 - rem; //ensure value is a multiple of 20
 
  digitalWrite(dir, LOW); //Pull direction pin low to move "forward"
  digitalWrite(MS1, HIGH); //Pull MS1, and MS2 high to set logic to 1/8th microstep resolution
  digitalWrite(MS2, HIGH);
  for(x= 0; x< val + 1600 ; x++)  // Move spindle one full rotation before going to the choosen card
  {
    digitalWrite(stp,HIGH); 
    delayMicroseconds(1275); // delay dictates how fast the spindle rotates.
    digitalWrite(stp,LOW); 
    delayMicroseconds(1275);
  }
  
//****************************************************************************
//****************************************************************************

// LED CODE

    if (val > 20 && val < 470) { // Major Arcana
      
      Yellow(1);
}
    else if (val > 471 && val < 750) { // Wands element: Fire
      
      Red(1);
}
    else if (val > 751 && val < 1030) { // Cups element: Water
      
      Blue(1);
}
    else if (val > 1031 && val < 1310) { // Swords element: Air
      
      White(1);
}
    else if (val > 1311 && val < 1600) { // Pentacles element: Earth
      
      Green(1);
}
//****************************************************************************
//****************************************************************************

// PRINTER CODE

  if (val == 40) // The Fool
  { 
  int readingType = Entropy.random(0, 31);
  Serial.print("The Fool");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("0_p", FILE_READ);
      printer.printBitmap(384, 660, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("0_o", FILE_READ);
      printer.printBitmap(384, 660, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("0_n", FILE_READ);
      printer.printBitmap(384, 660, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 60) // The Magician
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31); 
  Serial.print("The Magician");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("1_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("1_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("1_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }
  
  else if (val == 80) // The High Priestess
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The High Priestess");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("2_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("2_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("2_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }
  
  else if (val == 100) // The Empress
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Empress");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("3_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("3_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("3_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 120) // The Emperor
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);   
  Serial.print("The Emperor");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("4_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("4_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("4_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 140) // The Hierophant
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Hierophant");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("5_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("5_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("5_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 160) // The Lovers
  {
//   int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);   
  Serial.print("The Lovers");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("6_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("6_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("6_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 180) // The Chariot
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);   
  Serial.print("The Chariot");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("7_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("7_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("7_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 200) // Strength
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);
  Serial.println("Strength");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("8_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("8_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("8_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 220) // The Hermit
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Hermit");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("9_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("9_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("9_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 240) // Wheel of Fortune
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("Wheel of Fortune");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("10_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("10_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("10_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 260) // Justice
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("Justice");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("11_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("11_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("11_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 280) // The Hanged Man
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Hanged Man");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("12_p", FILE_READ);
      printer.printBitmap(384, 660, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("12_o", FILE_READ);
      printer.printBitmap(384, 660, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("12_n", FILE_READ);
      printer.printBitmap(384, 660, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 300) // Death
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("Death");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("13_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("13_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("13_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 320) // Temperance
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("Temperance");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("14_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("14_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("14_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 340) // The Devil
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Devil");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("15_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("15_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("15_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }  

  else if (val == 360) // The Tower
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Tower");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("16_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("16_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("16_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

  else if (val == 380) //The Star
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31);  
  Serial.print("The Star");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("17_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("17_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 20)
    {
      Serial.print("Reading type is: Reversed");
      Serial.println("");
      File data = SD.open("17_n", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
  }

    else if (val == 400) // The Moon
  {
//  int readingType = 5;
//  int readingType = 15;
//  int readingType = 25;  
  int readingType = Entropy.random(0, 31); 
  Serial.print("The Moon");
  Serial.println("");
  Serial.println("");
    if (readingType <= 9)
    {
      Serial.print("Reading type is: Upright");
      Serial.println("");
      File data = SD.open("18_p", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
    else if (readingType >= 10 && readingType <= 19)
    {
      Serial.print("Reading type is: Open");
      Serial.println("");
      File data = SD.open("18_o", FILE_READ);
      printer.printBitmap(384, 661, dynamic_cast<Stream*>(&data));
      data.close();
    }
...

This file has been truncated, please download it to see its full contents.

Credits

i_mozy

i_mozy

1 project • 5 followers
I’m an NYC based maker who creates utilitarian electronic objects that fulfill spiritual functions.
Thanks to Scott Bezek.

Comments