Created
March 17, 2019 00:32
-
-
Save resba/49282364410094bd6b588599bf023130 to your computer and use it in GitHub Desktop.
silly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************* | |
Example code for the Adafruit RGB Character LCD Shield and Library | |
This code displays text on the shield, and also reads the buttons on the keypad. | |
When a button is pressed, the backlight changes color. | |
**********************/ | |
// include the library code: | |
#include <Wire.h> | |
#include <Adafruit_RGBLCDShield.h> | |
//#include <Adafruit_MCP23017.h> | |
byte heart[8] = { | |
0b00000, | |
0b01010, | |
0b11111, | |
0b11111, | |
0b11111, | |
0b01110, | |
0b00100, | |
0b00000 | |
}; | |
// The shield uses the I2C SCL and SDA pins. On classic Arduinos | |
// this is Analog 4 and 5 so you can't use those for analogRead() anymore | |
// However, you can connect other I2C sensors to the I2C bus and share | |
// the I2C bus. | |
Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield(); | |
// These #defines make it easy to set the backlight color | |
#define RED 0x1 | |
#define YELLOW 0x3 | |
#define GREEN 0x2 | |
#define TEAL 0x6 | |
#define BLUE 0x4 | |
#define VIOLET 0x5 | |
#define WHITE 0x7 | |
void setup() { | |
// Debugging output | |
Serial.begin(9600); | |
// set up the LCD's number of columns and rows: | |
lcd.begin(16, 2); | |
// Print a message to the LCD. We track how long it takes since | |
// this library has been optimized a bit and we're proud of it :) | |
int time = millis(); | |
lcd.print("Hi, my name is:"); | |
lcd.setCursor(0, 1); | |
lcd.print("Yuuki"); | |
time = millis() - time; | |
Serial.print("Took "); Serial.print(time); Serial.println(" ms"); | |
lcd.setBacklight(WHITE); | |
lcd.createChar(0, heart); | |
} | |
String message[10] = {"Why can't we getalong","You're *hilarious*","Kappa","This speedrun sucks.","Mobile Quotewall <3 <3 <3 <3 <3 ","ayy lmao","Well isnt that Lewd~ <3","Gosh Heckie","@w@","awuwuwuwuwuwuwu!"}; | |
String names[19] = {"Yuuki", "Kayya", "Kilojoule Jackal", "Kaisa", "C0TT1N", "Subspace", "Balloonala", "Sparks", "Tammy", "Netasha", "Faith", "Gyro", "CHOMP", "Umbreon", "Fishbutt", "Farfetch'd", "Celeste", "Notkea", "Missed"}; | |
uint8_t i=0; | |
int u = 0; | |
int z = 0; | |
void loop() { | |
// set the cursor to column 0, line 1 | |
// (note: line 1 is the second row, since counting begins with 0): | |
lcd.setCursor(0, 1); | |
// print the number of seconds since reset: | |
//lcd.print(millis()/1000); | |
uint8_t buttons = lcd.readButtons(); | |
if (buttons) { | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("Hi, my name is:"); | |
lcd.setCursor(0,1); | |
if (buttons & BUTTON_UP) { | |
lcd.print("Yuuki"); | |
//lcd.setBacklight(RED); | |
} | |
if (buttons & BUTTON_DOWN) { | |
lcd.print("Kaisa"); | |
//lcd.setBacklight(YELLOW); | |
} | |
if (buttons & BUTTON_LEFT) { | |
//lcd.print(names[z]); | |
//z++; | |
//if(z<3){ | |
// z = 0; | |
//} | |
lcd.setCursor(0,0); | |
lcd.print(" I'm on Duty <3 "); | |
lcd.setCursor(0,1); | |
lcd.print(" May I help you "); | |
//lcd.setBacklight(GREEN); | |
} | |
if (buttons & BUTTON_RIGHT) { | |
lcd.print(names[z]); | |
z = z - 1; | |
if(z<0){ | |
z = 18; | |
} | |
//lcd.setBacklight(TEAL); | |
} | |
if (buttons & BUTTON_SELECT) { | |
lcd.clear(); | |
int v = random(0,10); | |
int len = message[v].length(); | |
if(len > 16){ | |
lcd.print(message[v].substring(0,16)); | |
lcd.setCursor(0,1); | |
lcd.print(message[v].substring(16,len)); | |
}else{ | |
lcd.print(message[v]); | |
} | |
//if(message.charAt(15)){ | |
// lcd.print(message[v]); | |
//} | |
//lcd.print(message[v]); | |
//lcd.setBacklight(VIOLET); | |
//lcd.write(byte(0)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment