12-06-2014, 06:15 PM
Taman sam prije 20 min iskopao 2 nova IR2110, kupim jos jedan i imam za trofazni most. Preostaje jedino odabir MOSFET-a, moram vidjet kakvu ponudu imaju u dućanu.
Evo i prve verzije koda, isprobao bi to sa motorom nekog cdroma
Evo i prve verzije koda, isprobao bi to sa motorom nekog cdroma
Code:
const int AH = 1;
const int AL = 2;
const int BH = 3;
const int BL = 4;
const int CH = 5;
const int CL = 6;
const int pot = A0;
int brzina = 0;
int deadtime = 4;
void setup(){
pinMode(AH, OUTPUT);
pinMode(AL, OUTPUT);
pinMode(BH, OUTPUT);
pinMode(BL, OUTPUT);
pinMode(CH, OUTPUT);
pinMode(CL, OUTPUT);
}
void loop(){
brzina = analogRead(pot);
digitalWrite(AH, HIGH);
digitalWrite(BL, HIGH);
delay(brzina);
digitalWrite(AH, LOW);
digitalWrite(BL, LOW);
delayMicroseconds(deadtime);
digitalWrite(BH, HIGH);
digitalWrite(CL, HIGH);
delay(brzina);
digitalWrite(BH, LOW);
digitalWrite(CL, LOW);
delayMicroseconds(deadtime);
digitalWrite(CH, HIGH);
digitalWrite(AL, HIGH);
delay(brzina);
digitalWrite(CH, LOW);
digitalWrite(AL, LOW);
delayMicroseconds(deadtime);
}