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. !! ^Y&@@@@@@@@@@@@@@
//@@@@@@@@@@&! .!Y~^^^........~? ^5@@@@@@@@@@@@@@@@@
//@@@@@@@@@&~ :~^^5:::^~~~~~~~7Y ~JG@@@@@@@@@@@@@@@@@@@
//@@@@@@@@#^ :~^. !! 7~ B@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@! ~! Y. .Y ~&@@@@@@@@@@@@@@@@@@@@@
//@@@@@@&!:G~ Y:... 7~ ?@@@@@@@@@@@@@@@@@@@@@@
//@@@@@&~!@P .G&###GPPPPPPB: G@@@@@@@@@@@@@@@@@@@@@@
//@@@@&^7@@P ~Y^~~~?JJJJJJG: .J@@@@@@@@@@@@@@@@@@@@@@@
//@@@&?J@@@@#P5775! JJ777?P#@@@@@@@@@@@@@@@@@@@@@@@@
//@@@GP@@@@@@@@@@@J..::. Y@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@P~^^~~~~~JG&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@G! ^P@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//no use joystick porque me iba terrible profe
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int leds[4] = {2, 3, 4, 5};
const int buttons[4] = {6, 7, 8, 9};
const char* directions[4] = {"Arriba", "Izquierda", "Derecha", "Abajo"};
void setup() {
for (int i = 0; i < 4; i++) {
pinMode(leds[i], OUTPUT);
pinMode(buttons[i], INPUT_PULLUP);
}
Wire.setSDA(16);
Wire.setSCL(17);
Wire.begin();
lcd.init();
lcd.backlight();
}
void loop() {
bool any = false;
for (int i = 0; i < 4; i++) {
bool pressed = digitalRead(buttons[i]) == LOW;
digitalWrite(leds[i], pressed ? HIGH : LOW);
if (pressed) {
lcd.setCursor(0, 0);
lcd.print(" ");
lcd.setCursor(0, 0);
lcd.print(directions[i]);
any = true;
}
}
if (!any) {
lcd.setCursor(0, 0);
lcd.print(" ");
}
}