Guys, when compiling a code in the Arduino IDE without errors, however some warnings appear. How do I know these warnings haven't harmed my program?
I made a code for ATtiny85 and received these warnings and the commands mentioned in the warnings were not used in the code. That's why I'm in doubt. Follow the warnings and the program.
warning: unused parameter 'pin' [-Wunused-parameter]
inline void DebugPulse(uint8_t pin, uint8_t count)
warning: unused parameter 'pin' [-Wunused-parameter]
inline void DebugPulse(uint8_t pin, uint8_t count)
warning: always_inline function might not be inlinable [-Wattributes]
void SoftwareSerial::setRxIntMsk(bool enable)
warning: always_inline function might not be inlinable [-Wattributes]
void SoftwareSerial::recv()
#include <SoftwareSerial.h>
#define SERIAL_TX PINB0
#define SERIAL_RX PINB1
int ADC1 = A1;
int ConvertValue = 0; // Variable to store the converted value of ADC0
int PowerValue = 0; // Variable to store the power value
int PreviousPowerValue = 0; // Variable to store the previous power value
unsigned long ADCTime = 0; //Time for reading the analog input
unsigned long SerialTime = 0; //Time for serial communication with the HMI
// Variables for analog reading smoothing
const int NReadings = 20; // Number of samples for smoothing. The higher the more smoothing and slow to react
int Reads[NLreads]; // Array with 20 indexes
int Index = 0; // Current index value
long Total = 0; // Value of sums of readings
int Average = 0; // Average of readings
SoftwareSerial mySerial(SERIAL_RX, SERIAL_TX);
void setup() {
// put your setup code here, to run once:
pinMode(PINB2, INPUT); // AN0 input (PB2 - Pin 7)
pinMode(PINB1, INPUT); // RX input (PB1 - Pin 6)
pinMode(PINB0, OUTPUT); // TX output (PB0 - Pin 5)
mySerial.begin(9600); //Start serial communication with baud rate = 9600
delay(1000);
}
void loop() {
// put your main code here, to run repeatedly:
if (millis() >= ADCTTime + 20) { // Reads the analog input every 20ms
ADCTime = millis();
ConvertValue = analogRead(ADC1); // Read the analog input
//Power Reading Smoothing
Total = Total - Readings[Index];
Readings[Index] = ConvertedValue;
Total = Total + Reads[Index];
Index = Index + 1;
if (Index >= NReadings) {
Index = 0;
}
Average = Total / NReadings;
PowerValue = map(Average, 0, 1023, 0, 100); // Remaps a number from one range to another
PowerValue = constrain(PowerValue, 0, 100); // Constrain a number to fall within a range
}
if ((millis() >= ADCTime + 200) && (PowerValue != PreviousPowerValue)) { // Performs serial communication every 200ms with changes in the power value
TimeSerial = millis();
PreviousPowerValue = PowerValue;
mySerial.print(PowerValue);
}
}