/********* 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: myProject - Source Code compiled for: Arduino Uno - Source Code created on: 2023-11-15 23:38:31 - Source Code generated by: Francesco Alessandro ********* Pleasedontcode.com **********/ /****** DEFINITION OF LIBRARIES *****/ #include /****** SYSTEM REQUIREMENT 1 *****/ /* I'm coding in Arduino and I'm trying to write a */ /* code that will ask for a number of inputs and then */ /* ask for each input individually. I set this */ /* number to six for now. */ const int numInputs = 6; /****** SYSTEM REQUIREMENT 2 *****/ /* I try entering in numbers but what happens is that */ /* every time I enter a number, it puts in zero for */ /* the next input without letting me choose: Ex: */ /* `Enter the amount of values: Please enter values */ /* for red light. Separate each value with a new */ /* line. */ int inputs[numInputs]; /****** FUNCTION PROTOTYPES *****/ void setup(void); void loop(void); /***** DEFINITION OF DIGITAL INPUT PINS *****/ const uint8_t data_PushButton_PIN_D2 = 2; void setup(void) { // put your setup code here, to run once: pinMode(data_PushButton_PIN_D2, INPUT_PULLUP); Serial.begin(9600); // Initialize serial communication } void loop(void) { // put your main code here, to run repeatedly: Serial.println("Enter the amount of values:"); while (!Serial.available()) {} // Wait for user input int numValues = Serial.parseInt(); // Read the number of values Serial.println("Please enter values for red light. Separate each value with a new line:"); for (int i = 0; i < numInputs; i++) { while (!Serial.available()) {} // Wait for user input inputs[i] = Serial.parseInt(); // Read the input value } // Print the entered values Serial.println("Entered values:"); for (int i = 0; i < numInputs; i++) { Serial.println(inputs[i]); } delay(1000); // Wait for 1 second before repeating the loop }