My code:
#include <SoftwareSerial.h>
SoftwareSerial myUART(0, 1);
#include <Adafruit_TFTLCD.h>
#include <Adafruit_GFX.h>
#include <TouchScreen.h>
#define LCD_CS A5
#define LCD_CD A4
#define LCD_WR A7
#define LCD_RD A8
#define LCD_RESET A6
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET);
void setup() {
myUART.begin(115200);
tft.reset();
uint16_t identifier = tft.readID();
tft.begin(identifier);
-------------------------------------
tft.setRotation(0);
tft.fillScreen(WHITE);
tft.setCursor(30,40); //Tal vez haya que cambiar la posicion
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.print("CONTROLADOR REYMI");
tft.setCursor(5,120);
tft.setTextColor(BLACK);
tft.setTextSize(1);
tft.print("Corriente:");
tft.setCursor(5,100);
tft.setTextColor(BLACK);
tft.setTextSize(1);
tft.print("Temperatura:");
}
void corriente(){
float c_TOTAL = 0;
int contador = 0;
int Prom = 10;
while ( contador < Prom ){
int c_READ = analogRead (A2);
float c_VOLT= c_READ*(5/1023);
c_TOTAL += c_VOLT;
contador +=1;
}
float c_CORR = c_TOTAL / Prom;
String corrString = String(c_CORR)+"mA";
tft.setCursor(10,120);
tft.setTextColor(BLACK);
tft.setTextSize(1);
tft.print(corrString);
delay(50);
}
void temperatura(){
myUART.println("T?");
while (myUART.available() > 0) {
char temp = myUART.read();
delay(50);
String tempString = String(temp)+"°C";
tft.setCursor(10,100); // Corrido de donde esta la corriente puesta
tft.setTextColor(BLACK);
tft.setTextSize(1);
tft.print(tempString);
}
}
void loop() {
corriente();
temperatura();
}
The errros are the following:
C:\Users\Reymi\Documents\Arduino\PE\PE.ino: In function 'void temperatura()':
PE:136:23: error: lvalue required as decrement operand
136 | myUART.println("T?");
| ^
exit status 1
EDIT: Only those two errors are giving me problems now. Thanks to both comments below.