Copiar 50 prints da serial pro excel

Oi galera já consegui ajuda de um americano mas queria saber se algum brasileiro poderia me ajudar, bom tenho um projeto que mostra a tempertura de 2 termopares MAX 31856, eles mostram a temperatura na tela e no serial, mas vamos focar no serial, então preciso que quando apertar uma letra especifica no serial 50 leituras sejam copiadas.

#include <MCUFRIEND_kbv.h>
#include <TouchScreen.h>
#include <Adafruit_GFX.h>
#include "Nanoshield_Termopar.h"
#include <SPI.h>
#include "Nanoshield_LCD.h"

Nanoshield_Termopar termopar(52 , TC_TYPE_K, TC_AVG_OFF );
Nanoshield_Termopar termopar2(50, TC_TYPE_K, TC_AVG_OFF );

Nanoshield_LCD lcd;
#define XM A2

#define YP A3
#define YM 9
#define XP 8

#define TS_MINX 90
#define TS_MINY 92
#define TS_MAXX 906
#define TS_MAXY 951

TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);

#define LCD_RESET A4
#define LCD_CS A3
#define LCD_CD A2
#define LCD_WR A1
#define LCD_RD A0


#define PRETO   0x0000
#define BRANCO 0xFFFF
#define AMARELO 0x0ff00
#define VERDE   0x07E0
#define VERMELHO 0xF800
MCUFRIEND_kbv tft;

#define MINPRESSURE 10
#define MAXPRESSURE 1000

bool error = false;
bool valor_botao1 = false;
bool valor_botao2 = false;

void telaInicial();
void setup() {

  Serial.begin(9600);
  termopar.begin();
  termopar2.begin();
  uint16_t ID = tft.readID();
  tft.begin(ID);
  tft.setRotation(1);


  telaInicial();
}

void loop() {
  TSPoint p = ts.getPoint();
  pinMode(XM, OUTPUT);
  digitalWrite(XM, LOW);
  pinMode(YP, OUTPUT);
  digitalWrite(YP, HIGH);
  pinMode(YM, OUTPUT);
  digitalWrite(YM, LOW);
  pinMode(XP, OUTPUT);
  digitalWrite(XP, HIGH);
  if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
    p.x = tft.width() - (map(p.x, TS_MINX, TS_MAXX, tft.width(), 0));
    p.y = tft.height() - (map(p.y, TS_MINY, TS_MAXY, tft.height(), 0));
  }


unsigned long tempoAtual = millis();
unsigned long tempoInicial = 0;

termopar.read(); 
 
tft.setTextColor(BRANCO);

  tft.setCursor(196, 150); 
  tft.print(termopar.getExternal());
  Serial.println (termopar.getExternal());
  Serial.println ("");

  termopar2.read();
  tft.setTextColor(BRANCO);
  tft.setCursor(196, 30); 
  tft.print(termopar2.getExternal());
  Serial.println (termopar2.getExternal());
  Serial.println ("");
  delay (1000);
 
  Serial.println (""); 
  Serial.println ("");
  Serial.println ("");

   criarBotao(186, 130, 125, 115, "", PRETO);
   criarBotao(186, 10, 125, 115, "", PRETO);
  criarBotao(20, 10, 125, 115, "", PRETO); 
  criarBotao(20, 130, 125, 115, "", PRETO);
 escreveEstado(32, 50, "Temp_1", BRANCO); 
  escreveEstado(32, 170, "Temp_2", BRANCO);

if (tempoAtual - tempoInicial >= 5000){
  if (p.y > 10 && p.y < 105) {
    if (p.x > 164 && p.x < 303) {
  tft.setTextSize(2);
      tft.setTextColor(BRANCO);
   tft.setCursor(196, 150);
    tft.print(termopar2.getExternal());
  delay (1000);
 }
}
}
if (tempoAtual - tempoInicial >= 5000){
 if (p.y > 10 && p.y < 105) {
    if (p.x > 44 && p.x < 175) {
  tft.setTextSize(2);
      tft.setTextColor(BRANCO);
   tft.setCursor(196,30);
    tft.print(termopar2.getExternal());
  delay (1000);
    }
}
}
}                                                         
void telaInicial() {
  tft.setRotation(3);
  tft.fillScreen(BRANCO);

  criarBotao(186, 130, 125, 115, "", PRETO);
  criarBotao(186, 10, 125, 115, "", PRETO);
  criarBotao(20, 10, 125, 115, "", PRETO); 
  criarBotao(20, 130, 125, 115, "", PRETO); 
  
  escreveEstado(32, 50, "Temp_1", BRANCO);
  escreveEstado(32, 170, "Temp_2", BRANCO);
  escreveEstado(140, 30, "Ext:", AMARELO);
  escreveEstado(140, 60, "Int:", AMARELO);
  escreveEstado(140, 150, "Ext:", AMARELO);
  escreveEstado(140, 180, "Int:", AMARELO);
}

void escreveEstado(int posx, int posy, String texto, int cor) {
  tft.setCursor(posx, posy);
  tft.setTextColor(cor);
  tft.setTextSize(2);
  tft.print(texto);
}

void criarBotao(int posx, int posy, int largura, int altura, String texto, int cor) {
  tft.fillRect(posx, posy, largura, altura, cor);
  tft.drawRect(posx, posy, largura, altura, PRETO);
  tft.setCursor(posx + 12, posy + 1000);
  tft.setTextColor(BRANCO);
  tft.setTextSize(3);
  tft.print(texto);
}

void atualizarBotao(int posx, int posy, int cor) {
  tft.fillRoundRect(posx, posy, 210, 48, 5, cor);
  escreveEstado(295, posy + 14, valor_botao1 ? "" : "", cor == VERDE ? BRANCO : PRETO);
}

Veja se isto ajuda:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.