CCCPaste

Programma Ivan

/********* Pleasedontcode.com **********

	Pleasedontcode thanks you for automatic code generation! Enjoy your code!

	- Terms and Conditions:
	Pleasedontcode gives you this package free of charge and you
	can use it for your personal projects. We will not be held liable for
	any loss or damage of any kind. For all terms and conditions,
	please visit pleasedontcode.com/termsandconditions

	- Project: Test Ivan
	- Source Code created on: 2023-05-01 16:42:18
	- Source Code generated by: Alessandro

********* Pleasedontcode.com **********/

/****** DEFINITION OF LIBRARIES *****/
#include "Arduino.h"

/***** DEFINITION OF DIGITAL OUTPUT PINS *****/
#define LED1_PIN_D2	2
#define LED2_PIN_D3	3

/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
bool LED1_PIN_D2_rawData = 0;
bool LED2_PIN_D3_rawData = 0;

/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float LED1_PIN_D2_phyData = 0.0;
float LED2_PIN_D3_phyData = 0.0;

void setup() {
  // put your setup code here, to run once:
  pinMode(LED1_PIN_D2, OUTPUT);
  pinMode(LED2_PIN_D3, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  int value1 = analogRead(A0); // read analog value from A0 pin
  int value2 = analogRead(A1); // read analog value from A1 pin
  Confronto(value1, value2); // call the Confronto function to compare the values
  updateOutputs(); // Refresh output data
}

void updateOutputs() {
  digitalWrite(LED1_PIN_D2, LED1_PIN_D2_rawData);
  digitalWrite(LED2_PIN_D3, LED2_PIN_D3_rawData);
}

void Confronto(int Intero1, int intero2) {
  /***** REQUIREMENT 1 *****/
  /* Riceve in input due valori interi, che poi li */
  /* confronta e accende il pin LED1 se i due valori */
  /* sono uguali oppure accende LED2 se i valori sono */
  /* diversi */
  if (Intero1 == intero2) {
    LED1_PIN_D2_rawData = 1;
    LED2_PIN_D3_rawData = 0;
  } else {
    LED1_PIN_D2_rawData = 0;
    LED2_PIN_D3_rawData = 1;
  }
}