Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define RELAIS_12V 11
- int adc_12v_old = 0;
- int adc_12v = 0;
- int adc_12v_upper_limit = 647; // 15V
- int adc_12v_lower_limit = 474; // 11V
- int ADC_12V = 0;
- void setup(void){
- pinMode(RELAIS_12V, OUTPUT);
- }
- void checkADC(void){
- adc_12v = analogRead(ADC_12V);
- if ((adc_12v > adc_12v_upper_limit) || (adc_12v < adc_12v_lower_limit)){
- digitalWrite(RELAIS_12V, LOW);
- }
- else{
- digitalWrite(RELAIS_12V, HIGH);
- }
- }
- void loop(){
- checkADC();
- delay(30);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement