Project in progress
The Compliment Machine

The Compliment Machine © GPL3+

Ever feel particularly down? Well, this attractive machine can give you all the appreciation you deserve with just the touch of a button.

  • 12 respects

Components and supplies

About this project


Your end product will be able to display various compliments of your choosing and will flash LEDs while doing so for an added touch.

How to Build a Compliment Machine:

Step One: Parts

Assemble all the parts listed in the components section.

Step Two: Beginning the Build with the LEDs

First, connect the power and ground to your breadboard. Next, you will need to place your display on the breadboard. It should be placed somewhere along the outermost row to maximize space. You should place your button so that it is inserted into both sections of the breadboard. Connect on of the leads to the ground using a 20 kilohm resistor and connect it to pin 8. Connect the other lead to 5V. Connect a 10kilohm resistor to the same lead that is connect to the ground and use it to also connect the button to the Arduino's digital pin 6. Later on in the build this will make it possible for the button to be connect to the display. Place your two LEDs in the breadboard. They can should be on the section of the breadboard that the display is not. Use the wires to connect the anode of the red LED to digital pin 7 and the anode of the blue LED to digital pin 13 on the Arduino. Also connect the LEDs to the ground using 220 ohm resistors.

Step Three: Connecting Your Display

As of the previous step, your display is already placed on your breadboard. However it is not yet connected to the Arduino or the button. In this step, you will be able to do that. Your display has sixteen pins in all. Here is how they are labeled.

Each pin's designation is crucial to whether or not your display will be able to work. The R/W pin puts the screen in read or write mode and the R/S pin controls where the characters appear on the display. The E/N pin tells the display it will be receiving a command and the data pins D0-D7 send character data to the display. The two outermost pins of the display, Vss and LED-, and the R/W pin should be connected to the ground. This will put the display in write mode. The Vcc pin is the power supply and should be connected to 5V. Furthermore, the LED+ pin connects to power through a 200 ohm resistor

Next, you'll need to connect the data pins to the Arduino. LCD D4 connects to Arduino digital pin 5; LCD D5 connects to Arduino digital pin 4; LCD D6 connects to Ardunio digital pin 3; lastly, LCD D7 connects to Arduino digital pin 2.

After that, connect EN on digital pin 11 and RS to pin 12. This will allow for writing to be displayed on the LCD.

Finally, the button connects to the machine through the ground to one of the pins on the display.


Code C/C++
int switchState = 0;
void setup() {
  pinMode(7, OUTPUT);
  pninMode(13, OUTPUT);
  pinMode(8, INPUT);
  // this makes all the LEDs the output while the switch or the button becomes the input

const int switchPin = 8;
unsigned long previousTime = 0; // this displays the last time an LED was last changed
int switchState2 = 0;
int prevSwitchState = 0;
int led = 7; // the LED connect to pin 7 will be the frst to turn on
long interval = 5000;// this creates a 5 second break before the other LED turns on

void setup2() {
  for (int x = 7; x<8;x++){ // this creates a loop that makes pin 7 the output and the switchPin 8 the input
    pinMode(x, OUTPUT);
  pinMode (switchPin, INPUT);

void loop() {
  unsigned long currentTime = millis ();
  if(currentTime - previousTime > interval) { //this allows the next LED to turn on after 5 seconds have passed 
    previousTime = currentTime; //previoiusTime = time once the LED has turned on
    digitalWrite(led, HIGH);
    if(led == 13) { // this checks if the other LED has turned on
switchState2 = digitalRead(switchPin);
if(switchState != prevSwitchState) { // this checks to see if the switchState is different from the prevSwitchState
  for(int x = 7;x<8;x++){ // if they are different, the LEDs turn off and the entire loop starts with LED that started first
    digitalWrite(x, LOW);
  led = 7;
  previousTime = currentTime
prevSwitchState = switchState;

void loop2() {
int switchState3 = digitalRead(8);
  // this checks the voltage for the switch in order to make sure it does its job
  if (switchState == LOW) { // the switch will have the following fucntions while it is not being pressed
    digitalWrite(7, HIGH); // this means that the red LED will be turned on
    digitalWrite(13, LOW); // while the blue LED will be off
  else { //meaning if the button is pressed
    digitalWrite(7, LOW); // this means red LED is off
    digitalWrite(13, HIGH); // but blue LED is on
    delay(125); // this creates a stopping period of 1/8 of a second
} // this final curly bracket closes the loop


  #include <LiquidCrystal.h>
  LiquidCrystal lcd( 12, 11, 5, 4, 3, 2); // these are the pins that allow the code to demand what the screen will say
  const int switchPin2 = 8; // this is a constant to hold the pin of the switch pin
  int switchState4 = 0; // this is a variable for the present state of the switch
  int prevSwitchState2 = 0; // this is another variable for the previous state of the switch
  int reply; // this variable dictates when a response on the screen will appear
    pinMode(switchPin, INPUT);
    lcd.print("Hello there!");
    lcd.setCursor(0,1); // (0,1) is the coordinate on the liquid crystal display where it will say the introduction
    lcd.print("Welcome to your personal compliment machine!");
void loop3() { // making it a loop allows the users to press the switch as many imes as they want to get as many compliments as they want
  switchState4 = digitalRead(switchPin);
  if (switchState! = prevSwitchState) {
    if (switchState4 == LOW) {
      reply = random(8); // this programs the different amount of compliments a person receive
      lcd.setCursor(0,0); // at this coordination it will say the following
      lcd.print("Hey girl");
      switch(reply){ // hear is the list of compliments that the screen supplies when the button is pressed
        case 0:
        lcd.print("You light up any room you walk into!");
        case 1:
        lcd.print("You look fabulous today!");
        case 2:
        lcd.print("You have such a positive charisma");
        case 3:
        lcd.print("How do you look so beautiful all the time?");
        case 4:
        lcd.print("You are beautiful inside and out");
        case 5:
        lcd.print("You are so inspiring and courageous");
        case 6:
        lcd.print("On a scale from 1 to 10, you're an 11!");
        case 7:
        lcd.print("You are a strong and fierce friend");
        case 8:
        lcd.print("Stay true to you because you are perfect the way you are!");
prevSwitchState = switchState4;
} // this closes the entire loop containing all the replies



Similar projects you might like

The Hooray Machine

Project showcase by Dawn Dupriest and Brie Hen

  • 1 comment
  • 5 respects

CNC Machine

Project tutorial by Manan Thareja

  • 23 respects

Object oriented state machine

by DGarbanzo

  • 1 comment
  • 3 respects

Arduino Morse Code Machine

Project showcase by Vlada Krsmanovic

  • 1 comment
  • 30 respects

CNC drawing machine with joysticks

Project showcase by TechnoFabrique

  • 5 respects

Caravaggio, A Drawing Machine

Project showcase by Michele

  • 123 respects
Add projectSign up / Login