Arduino e touchscreen

buonasera,
sono una studentessa di Ingegneria. Sto cercando di costruire un syringe heater.
Ho Arduino come elemento centrale. Ad arduino sono collegati una termocoppia, un touchscreen e un elemento riscaldante a 12V. Alimento Arduino con un alimentatore esterno da 12V,24W. Quando il circuito è connesso, dopo alcuni minuti lo schermo inizia a lampeggiare dicendo “mouting”. Ho pensato che fosse un problema di alimentazione esterna ma non posso diminuirla altrimenti l’elemento riscaldante non si scalda.
Allego il circuito e il codice su Arduino.
Grazie per qualsiasi aiuto `

#include <genieArduino.h> //interact between 4D touch pad and arduino, https://github.com/4dsystems/ViSi-Genie-Arduino-Library
#include <PID_v1.h> //PID control heater, https://github.com/br3ttb/Arduino-PID-Library/
#include <SPI.h>
#include "Adafruit_MAX31855.h" 
#define MAXSS   10
Adafruit_MAX31855 thermocouple(MAXSS);

//Keyboard variables
char keyvalue[10]; // array to hold keyboard values
char keyvalue2[10]; // array to hold keyboard values
int temp; //temporary event variable from keyboard
int counter = 0;
int counter2 = 0;

//Temperature variables
bool RunHeater = 0;
float TempSetPoint = 40; //setpoint temperature (default 37);
int tempPin = 0; //the analog pin the TMP36's Voltage-out pin is connected to
int heaterPin = A5; //the analog pin the TIP 120 transistor is connected to
int x;
unsigned int tempReading = 0;
unsigned long tempReadingTotal = 0;
double Setpoint, Input, Output, temperatureC;

//Define the Tuning Parameters
double Kp = 150, Ki = 1, Kd = 0;

//Specify the links and tuning parameters
PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT);

Genie genie;
#define RESETLINE 4  // Change this if you are not using an Arduino Adaptor Shield Version 2 (see code below)
void setup()
{
  Serial.begin(200000);  // Serial0 @ 200000 (200K) Baud
  genie.Begin(Serial);   // Use Serial0 for talking to the Genie Library, and to the 4D Systems display
  genie.AttachEventHandler(myGenieEventHandler); // Attach the user function Event Handler for processing events

  // Reset the Display (change D4 to D2 if you have original 4D Arduino Adaptor)
  // THIS IS IMPORTANT AND CAN PREVENT OUT OF SYNC ISSUES, SLOW SPEED RESPONSE ETC
  // If NOT using a 4D Arduino Adaptor, digitalWrites must be reversed as Display Reset is Active Low, and
  // the 4D Arduino Adaptors invert this signal so must be Active High.
  pinMode(RESETLINE, OUTPUT);  // Set D4 on Arduino to Output (4D Arduino Adaptor V2 - Display Reset)
  digitalWrite(RESETLINE, 1);  // Reset the Display via D4
  delay(100);
  digitalWrite(RESETLINE, 0);  // unReset the Display via D4

  delay (3500); //let the display start up after the reset (This is important)

  // Set the brightness/Contrast of the Display - (Not needed but illustrates how)
  // Most Displays, 1 = Display ON, 0 = Display OFF. See below for exceptions and for DIABLO16 displays.
  // For uLCD-43, uLCD-220RD, uLCD-70DT, and uLCD-35DT, use 0-15 for Brightness Control, where 0 = Display OFF, though to 15 = Max Brightness ON.
  genie.WriteContrast(15);
  genie.WriteObject(GENIE_OBJ_LED_DIGITS, 0, TempSetPoint * 10); // display default temp set point
  myPID.SetMode(AUTOMATIC); //set up PID mode
  myPID.SetTunings(Kp, Ki, Kd);
}

void loop()
{
  static long waitPeriod = millis();  //initialize waitperiod to do temperature measurement and PID computation

  genie.DoEvents(); // This calls the library each loop to process the queued responses from the display

  //read temperature value and write to LED Digits
  if (millis() >= waitPeriod)
  {
//genie.WriteObject(GENIE_OBJ_LED_DIGITS, 5, speedvalue);
 //tempReadingTotal = 0;
//    /Read 64 readings
//for (x = 0; x < 64; x++)
  //{
 //tempReadingTotal += analogRead(tempPin);
 //}
   //Divide by 64
   //tempReading = tempReadingTotal / 64.0;
   //double voltage = tempReading * 5000.0 / 1024.0;
    temperatureC = thermocouple.readCelsius();
   //temperatureC = (voltage - 500.0) / 10.0;
    //write measured value to LED Digits and scope
        genie.WriteObject(GENIE_OBJ_LED_DIGITS, 2, temperatureC*10);
        genie.WriteObject(GENIE_OBJ_LED_DIGITS, 3, temperatureC*10);
        genie.WriteObject(GENIE_OBJ_SCOPE, 0x00, (temperatureC-20)*2);  //scope goes from 0 to 80. However, scale is from 20 to 60.
        genie.WriteObject(GENIE_OBJ_SCOPE, 0x00, (TempSetPoint-20)*2);

    //PID and heater control
    if (RunHeater == true)
    {
      Input = temperatureC;
      Setpoint = TempSetPoint;
      myPID.Compute();
      analogWrite(heaterPin, Output);
      genie.WriteObject(GENIE_OBJ_LED_DIGITS, 4, Output/255*100);
    }
    else
    {
      analogWrite(heaterPin, 0);
      genie.WriteObject(GENIE_OBJ_LED_DIGITS, 4, 0);
    }
    waitPeriod = millis() + 1000; // rerun this code after 5000 ms
  }
}

/////////////////////////////////////////////////////////////////////
//
// This is the user's event handler. It is called by genieDoEvents()
// when the following conditions are true
//
//		The link is in an IDLE state, and
//		There is an event to handle
//
// The event can be either a REPORT_EVENT frame sent asynchronously
// from the display or a REPORT_OBJ frame sent by the display in
// response to a READ_OBJ (genie.ReadObject) request.
//

void myGenieEventHandler(void)
{
  genieFrame Event;
  genie.DequeueEvent(&Event);

  //Filter Events from Keyboard0 (Index = 0) for setting Temperature
  //genie.EventIs usage: genie.EventIs(&Event,GENIE_REPORT_XX,GENIE_OBJ_XX,index of object).
  if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_KEYBOARD, 0))
  {
    temp = genie.GetEventData(&Event);  // Receive the event data from the Keyboard
    if (temp >= 48 && temp <= 57 && counter <= 5)
    {
      keyvalue[counter] = temp;
      genie.WriteStr(1, keyvalue); //prints to String Object
      counter = counter + 1; //increment array
    }
    else if (temp == 110) // . key
    {
      keyvalue[counter] = '.';        // Receive the event data from the keyboard
      genie.WriteStr(1, keyvalue); //prints to String Object
      counter = counter + 1; //increment array
    }
    else if (temp == 8)      // backspace
    {
      counter--;
      keyvalue[counter] = '.';
      genie.WriteStr(1, keyvalue); //prints to String Object
    }
    else if (temp == 13) //enter key = 13
    {
      //genie.WriteStr(0,keyvalue);
      TempSetPoint = atof(keyvalue);
      genie.WriteObject(GENIE_OBJ_FORM, 0x00, 0); //switch back to form 0
      for (int x = 0; x < counter ; x++)
      {
        keyvalue[x] = 0;
      }
      genie.WriteStr(1, keyvalue);
      counter = 0;
    }
    genie.WriteObject(GENIE_OBJ_LED_DIGITS, 0, TempSetPoint * 10);   // Write Keyboard0 value to to LED Digits (temperature set point)
  }

  if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_WINBUTTON, 1)) //back to main WINBUTTON
  {
    genie.WriteObject(GENIE_OBJ_FORM, 0x00, 0); //switch back to form 0
  }

  if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_WINBUTTON, 3)) //back to main WINBUTTON
  {
    genie.WriteObject(GENIE_OBJ_FORM, 0x00, 0); //switch back to form 0

  }

  if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_WINBUTTON, 5)) //back to main WINBUTTON
  {
    genie.WriteObject(GENIE_OBJ_FORM, 0x00, 0); //switch back to form 0
  }

  //Filter Events from 4DButton0 (Index = 0) for starting heater
  if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_4DBUTTON, 0))
  {
    RunHeater = genie.GetEventData(&Event);
    genie.WriteObject(GENIE_OBJ_4DBUTTON, 2, RunHeater);
  }
  if (genie.EventIs(&Event, GENIE_REPORT_EVENT, GENIE_OBJ_4DBUTTON, 2))
  {
    RunHeater = genie.GetEventData(&Event);
    genie.WriteObject(GENIE_OBJ_4DBUTTON, 0, RunHeater);
  }
}

@saracarmosino7 : in conformità al REGOLAMENTO della sezione Italiana del Forum, punto 13, il cross-posting è proibito (anche tra lingue diverse) e tu hai già posto la stessa domanda QUI.

Non solo, in quel thread ti stanno già rispondendo e NON è carino abbandonare una discussione e chi ti stava aiutando, per venire di qua a porre la stessa domanda … :roll_eyes:

Quindi, per rispetto verso chi ti stava già aiutando nell’altro thread, questo tuo thread viene chiuso e ti prego di continuare dove avevi cominciato. Grazie.

Guglielmo