/*
PINES USADOS POR LA PLACA MAKER FANIOT V2
BOTONES (USAN RESISTENCIA PULLUP / MANDAN UN 0 CUANDO SE PULSAN)
----------------------------------------------------------------
BOTON IZQUIERDO - PIN 0
BOTON MEDIO - PIN 15
BOTON DERECHO - PIN 13
PANTALLA OLED
--------------
SDA - PIN 21
SCL - PIN 22
BUZZER
-------
PIN 12
LEDS RGB NEOPIXEL
-----------------
PIN 27
*/
#include <FastLED.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ABLocks_TimerFreeTone.h>
CRGB neopixelFL_leds[4];
Adafruit_SSD1306 oled_1(128, 64, &Wire, -1);
bool oled_1_autoshow = false;
String rtt_melody_13 = ":d=4,o=5,b=160:e6,8b,8c6,8d6,16e6,16d6,8c6,8b,a,8a,8c6,e6,8d6,8c6,b,8b,8c6,d6,e6,c6,a,2a,8p";
void setup() {
pinMode(12, OUTPUT);
pinMode(0, INPUT);
pinMode(15, INPUT);
pinMode(13, INPUT);
FastLED.addLeds<WS2812B, 27, GRB>(neopixelFL_leds, 4);
FastLED.setBrightness(60);
FastLED.clear();
neopixelFL_leds[(int)(0)].r = 255;
neopixelFL_leds[(int)(0)].g = 0;
neopixelFL_leds[(int)(0)].b = 0;
neopixelFL_leds[(int)(1)].r = 51;
neopixelFL_leds[(int)(1)].g = 204;
neopixelFL_leds[(int)(1)].b = 0;
neopixelFL_leds[(int)(2)].r = 51;
neopixelFL_leds[(int)(2)].g = 204;
neopixelFL_leds[(int)(2)].b = 255;
neopixelFL_leds[(int)(3)].r = 204;
neopixelFL_leds[(int)(3)].g = 51;
neopixelFL_leds[(int)(3)].b = 204;
FastLED.show();
oled_1.begin(SSD1306_SWITCHCAPVCC, 0x3C);
oled_1.clearDisplay();
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(3);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 0);
oled_1.print(String("FANIOT V2"));
if (oled_1_autoshow)oled_1.display();
oled_1.display();
TimerFreeToneRtttl(12, (const char *)rtt_melody_13.c_str());
}
void loop() {
yield();
if (((!digitalRead(0)) == true)) {
oled_1.clearDisplay();
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 0);
oled_1.print(String("SE APRETO EL"));
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 30);
oled_1.print(String("BOTON IZQ"));
if (oled_1_autoshow)oled_1.display();
oled_1.display();
delay(1000);
}
if (((!digitalRead(15)) == true)) {
oled_1.clearDisplay();
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 0);
oled_1.print(String("SE APRETO EL"));
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 30);
oled_1.print(String("BOTON MEDIO"));
if (oled_1_autoshow)oled_1.display();
oled_1.display();
delay(1000);
}
if (((!digitalRead(13)) == true)) {
oled_1.clearDisplay();
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 0);
oled_1.print(String("SE APRETO EL"));
if (oled_1_autoshow)oled_1.display();
oled_1.setTextSize(1);
oled_1.setTextColor(WHITE);
oled_1.setCursor(0, 30);
oled_1.print(String("BOTON DER"));
if (oled_1_autoshow)oled_1.display();
oled_1.display();
delay(1000);
}
}
BOTONES:
BOTON IZQUIERDO - PIN 0
BOTON MEDIO - PIN 15
BOTON DERECHO - PIN 13
PANTALLA OLED:
SDA - PIN 21
SCL - PIN 22
--
BUZZER - PIN 12
LEDS RGB - PIN 27
OTROS PINES:
SENSOR DE BATERIA - PIN 36
SENSOR DE VIBRACION - PIN 14
SENSOR DE LUZ - PIN 39
PINES PARA USAR:
------------------------------
PIN 32
PIN 35
PIN 34
PIN 33
PIN 25
PIN 36
PIN 16
PIN 17
PIN 05
PIN 18
PIN 19
PIN 23