to digital pin

This commit is contained in:
Lurkars 2020-12-28 16:46:07 +01:00
parent fa0158d122
commit 5427168fb2

View File

@ -1,14 +1,12 @@
const int HALL_PIN = A0; const int HALL_PIN = 2;
void setup() { void setup() {
Serial.begin(9200);
pinMode(LED_BUILTIN, OUTPUT); pinMode(LED_BUILTIN, OUTPUT);
pinMode(HALL_PIN, INPUT); pinMode(HALL_PIN, INPUT);
} }
void loop() { void loop() {
int hall_value = analogRead(HALL_PIN); int hall_value = digitalRead(HALL_PIN);
Serial.println(hall_value); digitalWrite(LED_BUILTIN, hall_value);
// digitalWrite(LED_BUILTIN, hall_value);
delay(10); //debounce? delay(10); //debounce?
} }