// Y VERTICAL
// X HORIZONTAL
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//Definindo parametros do Display
#define LARGURA_OLED 128
#define ALTURA_OLED 64
#define RESET_OLED -1
Adafruit_SSD1306 display(LARGURA_OLED, ALTURA_OLED, &Wire, RESET_OLED);
// string -> int (ascii)
String str = "";
void setup() {
Serial.begin(9600);
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.display();
Serial.setTimeout(10);
Serial.println("Inicializando...");
delay(1000);
}
void loop() {
receive();
}
void receive() {
if (Serial.available() > 0) {
str = Serial.read();
str.trim();
Serial.println(str);
display.clearDisplay(); // limpa o display
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(1, 1);
display.print(str); // imprime str no display
display.display(); // exibe no display
}
}
// bota no array e exclui o ultimo (enter);
void convert() {
}
/*
receive string from serial monitor
convert to int
from int convert to ascii char
then display on lcd
https://docs.oracle.com/javase/6/docs/api/java/lang/Character.html#toString%28char%29
https://stackoverflow.com/questions/7693994/how-to-convert-ascii-code-0-255-to-its-corresponding-character
A - Z
65 - 90
a - z
97 - 122
*/