analog value works
This commit is contained in:
parent
529c78ce45
commit
75c0a2af6e
|
|
@ -1,3 +1,4 @@
|
|||
// Blink LED on pin 13, read analog input from A0, and print to Serial
|
||||
|
||||
void setup() {
|
||||
pinMode(13, OUTPUT); // Set pin 13 as output
|
||||
|
|
@ -6,10 +7,14 @@ void setup() {
|
|||
|
||||
void loop() {
|
||||
digitalWrite(13, HIGH); // Turn the LED on
|
||||
Serial.println("LED ON"); // Print status
|
||||
int analogValue = analogRead(A0); // Read analog value from A0
|
||||
Serial.print("LED ON - Analog Value: ");
|
||||
Serial.println(analogValue); // Print the analog value
|
||||
delay(1000); // Wait 1 second
|
||||
|
||||
digitalWrite(13, LOW); // Turn the LED off
|
||||
Serial.println("LED OFF"); // Print status
|
||||
analogValue = analogRead(A0); // Read analog again
|
||||
Serial.print("LED OFF - Analog Value: ");
|
||||
Serial.println(analogValue); // Print the analog value
|
||||
delay(1000); // Wait 1 second
|
||||
}
|
||||
Loading…
Reference in New Issue