Motivation Button

by hacker-cycle in Circuits > Microcontrollers

2237 Views, 12 Favorites, 0 Comments

Motivation Button

IMG_3459.JPG
IMG_3460.JPG

This is a simple intro project for creating a "Motivation Button" with the intel Edison and the grove starter kit.

All you will need is a computer, a configured Intel Edison and the grove starter kit.

So lets jump right in!

Plug It In

IMG_3462.JPG
IMG_3461.JPG

Connect both micro usb cables to your computer, and open the Arduino app.

Put in the spark shield on your Edison and plug in your Grove LCD RBG Backlight to I2C port and your Grove Button into D2 port.

Code It!

Screen Shot 2015-01-05 at 8.19.18 PM.png

In the Arduino app paste in this code:

<p>#include "rgb_lcd.h"</p><p>#include <Wire.h></p><p>rgb_lcd lcd;</p><p>const int buttonPin = 2;</p>void setup() 
{   lcd.begin(16, 2);
    pinMode(buttonPin, INPUT);
}
int colorR = 25;
int colorG = 255;
int colorB = 100;
void loop() 
{
  lcd.setRGB(colorR, colorG, colorB);
  lcd.clear();
  int buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {
    lcd.write("You can do it!");
    int colorG = 255;
    int colorR = 0;
  } else {
    lcd.write("Need motivation?");
    int colorR = 255;
    int colorG = 0;
  }
 delay(100);
}


Click the arrow pointing to the right to upload