Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* 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-13 23:06:35
- - Source Code generated by: Francesco Alessandro
- ********* Pleasedontcode.com **********/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- /****** SYSTEM REQUIREMENT 1 *****/
- const int numInputs = 6; // Number of inputs required
- /****** SYSTEM REQUIREMENT 2 *****/
- int inputs[numInputs]; // Array to store the inputs
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- void readInputs(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:
- readInputs(); // Call the function to read inputs
- }
- void readInputs(void)
- {
- Serial.print("Enter the amount of values: ");
- while (Serial.available() == 0)
- {
- // Wait for user input
- }
- int amount = Serial.parseInt(); // Read the amount of values
- Serial.println("Please enter values for red light. Separate each value with a new line.");
- for (int i = 0; i < amount; i++)
- {
- while (Serial.available() == 0)
- {
- // Wait for user input
- }
- inputs[i] = Serial.parseInt(); // Read the input value
- }
- // Print the inputs
- Serial.println("Entered values:");
- for (int i = 0; i < amount; i++)
- {
- Serial.println(inputs[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement