Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup()
- {
- pinMode(13, OUTPUT); // sets the digital pin 13 as output
- pinMode(12, OUTPUT); // sets the digital pin 12 as output
- Serial.begin(9600);
- }
- void loop()
- {
- int valorADC;
- float voltaje;
- valorADC = analogRead(A5);
- voltaje = valorADC * (5.0 / 1023.0);
- Serial.println(voltaje);
- if(voltaje>4.5)
- {
- digitalWrite(12, HIGH); // sets the digital pin 13 on
- //delay(1000); // waits for a second
- digitalWrite(13, LOW); // sets the digital pin 13 off
- //delay(1000); // waits for a second
- }
- else
- {
- digitalWrite(13, HIGH); // sets the digital pin 13 on
- //delay(1000); // waits for a second
- digitalWrite(12, LOW); // sets the digital pin 13 off
- //delay(1000); // waits for a second
- }
- delay(2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement