Difference between revisions of "Decision Assistant"

From Robo-T
Jump to: navigation, search
(Created page with "rightright A box that gives random answers to the question "Should I do ...?" Another butto...")
 
 
Line 43: Line 43:
 
   delay(100);
 
   delay(100);
 
  }
 
  }
 +
</nowiki>
 +
 +
 +
<nowiki>
 +
/*  LAC Decision assistant
 +
*      Thomas Fleming May 2017
 +
*    Simple fortune 8-ball like program
 +
*      (could add shake to get results feature instead of button).
 +
*      Note: Leonardo has some wierd behaviour on digitalRead
 +
*            and will activate after button release.
 +
*      doesn't work as expected.  Works differnt on UNO
 +
*     
 +
*/
 +
#include <Wire.h>
 +
#include <LiquidCrystal_I2C.h>
 +
LiquidCrystal_I2C lcd(0x27,16,2);
 +
 +
int button=3;
 +
 +
void setup() {
 +
  pinMode(button,INPUT_PULLUP);
 +
  lcd.init();
 +
  lcd.backlight();
 +
  lcd.print("The LAC Decision");
 +
  lcd.setCursor(0,1);
 +
  lcd.print("    Assistant");
 +
 +
}
 +
 +
void loop() {
 +
bool checkbutton=digitalRead(button);
 +
if(!checkbutton){
 +
  lcd.clear();
 +
  int num=random(0,13);
 +
  if (num==0){
 +
    lcd.print("NORMAL QE PO");}
 +
  else if (num==1){
 +
    lcd.print("ASNJEHERE");}
 +
  else if (num==2){
 +
    lcd.print("NDOSHTA KA MUNDESI");}
 +
  else if (num==3){
 +
    lcd.print("HIQE NGA MENDJA");}
 +
else if (num==4){
 +
  lcd.print("CFARE PO PRET");}
 +
  else if (num==5){
 +
    lcd.print("KE 50% SHANS");}
 +
    else if (num==6){
 +
      lcd.print("IK FLI GJUME ME MIRE");}
 +
  else if (num==7){
 +
    lcd.print(" ");}
 +
else if (num==8){
 +
  lcd.print("  ");}
 +
  else if (num==9){
 +
    lcd.print("  ");}
 +
else if (num==10){
 +
  lcd.print("  ");}
 +
  else if (num==11){
 +
    lcd.print("  ");}
 +
    else if (num==12){
 +
      lcd.print(" ");}
 +
 
 +
}
 +
  else{};
 +
  delay(100);
 +
  }
 +
 
</nowiki>
 
</nowiki>

Latest revision as of 02:01, 11 May 2017

Decisionbox.jpg
Decisionconnections.jpg

A box that gives random answers to the question "Should I do ...?" Another button can be added for a more interactive approach.

/*   LAC Decision assistant
 *       Thomas Fleming May 2017
 *    Simple fortune 8-ball like program
 *      (could add shake to get results feature instead of button).
 *      Note: Leonardo has some wierd behaviour on digitalRead 
 *            and will activate after button release.
 *      doesn't work as expected.  Works differnt on UNO
 *      
 */
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);

int button=3;

void setup() {
  pinMode(button,INPUT_PULLUP);
  lcd.init();
  lcd.backlight();
  lcd.print("The LAC Decision");
  lcd.setCursor(0,1);
  lcd.print("    Assistant");
 
}

void loop() {
 bool checkbutton=digitalRead(button);
 if(!checkbutton){
  lcd.clear();
  int num=random(0,3);
  if (num==0){
    lcd.print("    YES!!!");}
  else if (num==1){
    lcd.print("    NO!!!");}
  else if (num==2){
    lcd.print("   Maybe");}}
  else{};
  delay(100);
 }


 /*   LAC Decision assistant
 *       Thomas Fleming May 2017
 *    Simple fortune 8-ball like program
 *      (could add shake to get results feature instead of button).
 *      Note: Leonardo has some wierd behaviour on digitalRead 
 *            and will activate after button release.
 *      doesn't work as expected.  Works differnt on UNO
 *      
 */
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);

int button=3;

void setup() {
  pinMode(button,INPUT_PULLUP);
  lcd.init();
  lcd.backlight();
  lcd.print("The LAC Decision");
  lcd.setCursor(0,1);
  lcd.print("    Assistant");
 
}

void loop() {
 bool checkbutton=digitalRead(button);
 if(!checkbutton){
  lcd.clear();
  int num=random(0,13);
  if (num==0){
    lcd.print("NORMAL QE PO");}
  else if (num==1){
    lcd.print("ASNJEHERE");}
  else if (num==2){
    lcd.print("NDOSHTA KA MUNDESI");}
  else if (num==3){
    lcd.print("HIQE NGA MENDJA");}
 else if (num==4){
  lcd.print("CFARE PO PRET");}
  else if (num==5){
    lcd.print("KE 50% SHANS");}
    else if (num==6){
      lcd.print("IK FLI GJUME ME MIRE");}
  else if (num==7){
    lcd.print(" ");}
 else if (num==8){
  lcd.print("  ");}
   else if (num==9){
    lcd.print("  ");}
 else if (num==10){
  lcd.print("  ");}
  else if (num==11){
    lcd.print("  ");}
    else if (num==12){
      lcd.print(" ");}
   
 }
  else{};
  delay(100);
  }