/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: **Communication Protocols**
- Source Code NOT compiled for: Arduino Mega
- Source Code created on: 2024-11-04 14:07:30
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* print one time output. */
/****** END SYSTEM REQUIREMENTS *****/
/* START CODE */
/****** DEFINITION OF LIBRARIES *****/
#include
#include
#include
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF PWM OUTPUT PINS *****/
const uint8_t out_PIN_D3 = 3;
/***** DEFINITION OF Hardware Serial *****/
#define uarthw Serial1 // TX_PIN: D18, RX_PIN: D19
/***** DEFINITION OF Software Serial *****/
const uint8_t uartsw_PIN_SERIAL_TX_D4 = 4;
const uint8_t uartsw_PIN_SERIAL_RX_A0 = A0;
SoftwareSerial uartsw(uartsw_PIN_SERIAL_RX_A0, uartsw_PIN_SERIAL_TX_D4);
/***** DEFINITION OF I2C PINS *****/
const uint8_t i2c_PIN_SDA_D20 = 20;
const uint8_t i2c_PIN_SCL_D21 = 21;
/***** DEFINITION OF SPI PINS *****/
const uint8_t spi_PIN_MOSI_D51 = 51;
const uint8_t spi_PIN_MISO_D50 = 50;
const uint8_t spi_PIN_SCLK_D52 = 52;
const uint8_t spi_PIN_CS_D53 = 53;
/***** DEFINITION OF OUTPUT RAW VARIABLES *****/
/***** used to store raw data *****/
uint8_t out_PIN_D3_rawData = 0;
/***** DEFINITION OF OUTPUT PHYSICAL VARIABLES *****/
/***** used to store data after characteristic curve transformation *****/
float out_PIN_D3_phyData = 0.0;
void setup(void)
{
// put your setup code here, to run once:
pinMode(out_PIN_D3, OUTPUT);
pinMode(spi_PIN_CS_D53, OUTPUT);
// start the SPI library:
SPI.begin();
uarthw.begin(300);
uartsw.begin(300);
// Print one-time output
Serial.begin(9600); // Initialize Serial for output
Serial.println("Setup complete. System is running."); // One-time output
}
void loop(void)
{
// put your main code here, to run repeatedly:
updateOutputs(); // Refresh output data
}
void updateOutputs()
{
analogWrite(out_PIN_D3, out_PIN_D3_rawData);
}
/* END CODE */