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: Mapped Potentiometer
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2023-12-10 04:33:01
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Acceleratore */
- /****** END SYSTEM REQUIREMENTS *****/
- /****** DEFINITION OF LIBRARIES *****/
- #include <Arduino.h>
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /***** DEFINITION OF ANALOG INPUT PINS *****/
- const uint8_t Ok_Potentiometer_Vout_PIN_A0 = A0; // Added missing semicolon
- void setup(void)
- {
- // put your setup code here, to run once:
- pinMode(Ok_Potentiometer_Vout_PIN_A0, INPUT);
- Serial.begin(9600); // Initialize the serial communication
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- // Read the value from the potentiometer
- int potValue = analogRead(Ok_Potentiometer_Vout_PIN_A0);
- // Map the potentiometer value to a desired range (0-100)
- int mappedValue = map(potValue, 0, 1023, 0, 100);
- // Print the mapped value to the serial monitor
- Serial.print("Mapped value: ");
- Serial.println(mappedValue);
- delay(1000); // Add a delay to slow down the loop
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement