Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define OUT 5
- #define ADC 0
- void setup() {
- ADMUX &= (0<<REFS0); //Setting reference voltage to internal 1.1V
- }
- // the loop routine runs over and over again forever:
- void loop() {
- // read the input on analog pin 0:
- int sensorValue = analogRead(0);
- float voltage = sensorValue * (1.1 / 1023.0);
- if (voltage>0.5){
- digitalWrite(OUT,HIGH);
- }
- else{
- digitalWrite(OUT,LOW);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement