Fortune Cookie(?)

The title of this blogpost may be a little misleading, but the process behind bringing my idea to life might give you some clarity regarding the naming. So when I was thinking “unexpected”, I immediately thought of magic eight balls and fortune cookies, with their random phrases and words of wisdom that I never seem to anticipate. I saw the box displayed in the image below, when I was walking around the lab; and it was as if the idea was calling to me.

Initially, I had considered using a temperature sensor, and have the different members of the audience touch it; which would then detect their body temperature and display a random statement (similar to the ones we find in fortune cookies). However, there were several flaws in that logic, since most people have similar body temperatures, and the changes in the temperature sensor were too minuscule to alternate between statements. I then decided to change to a different analog sensor; the photoresistor. the photoresistor was easier to operate, since it encompasses a wider range of values when exposing it to light or darkness. But, I wasn’t able to devise a way to adapt the fortune cookie scenario to the function of the photoresistor, and instead opted for a different narrative. I will hopefully be able to implement and develop this idea further with more knowledge of code.

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);   //defining lcd pins

int sensorValue = 0; // variable to store the value coming from the sensor
int sensorPin = A0; // select the input pin for LDR
void setup()
  pinMode(3,INPUT);      //setting arduino pin3 as input
  Serial.begin(9600);   // opens serial port, sets data rate to 9600 bps
  lcd.begin(16,2);      // set up the LCD's number of columns and rows

void loop()
sensorValue = analogRead(sensorPin); // read the value from the sensor
Serial.println(sensorValue); //prints the values coming from the sensor on the screen

//display text on lcd
if (sensorValue < 50) {
  lcd.print("Never leave me");
} else {
  lcd.print("This is why I");
  lcd.print("have trust issues");

// Turn off the display:
  // Turn on the display:



Leave a Reply