0
ειναι ο κώδικας για το τροφοδοτικό μου Untitled.jpg(1920χ1080)
λιπουν πραματα κι υπαρχουν extrasΚώδικας:#include <SPI.h>;#include <LiquidCrystal.h>;//LCD float R1 = 100000.0;//input1 resistor1 float R2 = 10000.0;//input1 resistor2 float R3 = 100000.0;//input2 resistor1 float R4 = 10000.0;//input2 resistor2 LiquidCrystal lcd (22, 23, 24, 25, 26, 27);//lcd int analogInput1 = 0 ;//mesure input 1 voltage int analogInput2 = 1 ;//mesure input 1 voltage float vout1 = 0.0;//μεταβλητη εξοδου 1 float vin1 = 0.0 ;// >> int value1 = 0; // >> float vout2 = 0.0;//μεταβλητη εξοδου 1 float vin2 = 0.0 ;// >> int value2 = 0; // >> int pinbutton1 = 6;//on off out int Relay = 7;//on off out int pinbutton2 = 5;//on off out int Relay2 = 4;//on off out int staterelay1 = LOW ;//on off out int statebutton1;//on off out int staterelay2 = LOW ;//on off out int statebutton2;//on off out int previous = LOW; //on off out long time = 0; long debounce = 500; int val; int encoder0PinA = 3;//for encoder int encoder0PinB = 2;// for encoder int encoder0Pos = 0;//for encoder int encoder0PinALast = LOW;//for encoder int n = LOW;//for encoder int csPin = 10 void setup() { pinMode (analogInput1, INPUT); pinMode (analogInput2, INPUT); pinMode ( pinbutton, INPUT ); pinMode ( Relay, OUTPUT); lcd.begin (16, 2); Serial.begin (9600); lcd.print ("DIGITAL PSU FINOS"); Serial.println ("DIDITAL PSU FINOS ........... WAIT FOR COMANT "); pinMode (encoder0PinA,INPUT); pinMode (encoder0PinB,INPUT); } void loop() { value1 = analogRead(analogInput1);//input 1 monitor vout1= (value1 * 5.0) / 1024 ; vin1 = vout1 / (R2/(R1+R2)); value2 = analogRead(analogInput2);// input 2 monitor vout2= (value2 * 5.0) / 1024 ; vin2 = vout2 / (R2/(R1+R2)); if (vin1<1.255) { vin1 = 0.0; } lcd.setCursor(0,1); lcd.print("VOUT= "); lcd.print(vin1); Serial.println("Vout = "); Serial.println(vin1); delay (2); if (pinbutton = HIGH) ; digitalWrite (Relay, HIGH ); n = digitalRead(encoder0PinA); if ((encoder0PinALast == LOW) && (n == HIGH)) { if (digitalRead(encoder0PinB) == LOW) { encoder0Pos--; } else { encoder0Pos++; if (encoder0Pos<0); encoder0Pos= 0; } Serial.print (encoder0Pos); Serial.print ("/"); } encoder0PinALast = n; }