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: Analog Sensor Output
- - Source Code compiled for: Arduino Uno
- - Source Code created on: 2024-02-11 13:56:47
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* Rad and Print Values of the sensor at A0 and A1 */
- /* pins. */
- /****** 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 CurrentSensor_PIN_A0 = A0;
- const uint8_t LDR_PIN_A1 = A1;
- void setup(void)
- {
- // Set the serial baud rate to 9600
- Serial.begin(9600);
- // Set the pin modes for the analog input pins
- pinMode(CurrentSensor_PIN_A0, INPUT);
- pinMode(LDR_PIN_A1, INPUT);
- }
- void loop(void)
- {
- // Read and print the values of the sensor at A0 and A1 pins
- int currentSensorValue = analogRead(CurrentSensor_PIN_A0);
- int ldrValue = analogRead(LDR_PIN_A1);
- Serial.print("Current Sensor Value at A0: ");
- Serial.println(currentSensorValue);
- Serial.print("LDR Value at A1: ");
- Serial.println(ldrValue);
- delay(1000); // Delay for 1 second
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement