Garrett 712120 VNT Hella 6NW 008 412 actuator.
Garrett 712120 VNT Hella 6NW 008 412 actuator.
#include <avr/interrupt.h>
int vntPin = 9; // LED connected to digital pin 9
int vanePos = 0 ;
int cnt = 0;
int dir = 0;
void setup() {
//graph
Serial.begin(57600);
//140hz 7.1ms ==
TCCR1A = _BV(COM0A0) | _BV(WGM01);
TCCR1B = _BV(CS02) | _BV(CS00);
OCR1A = 222;
}
void loop() {
if (cnt % 1000==0) {
if (dir==1) {
if(vanePos < 255) {
vanePos +=25.5;
if (vanePos>255)vanePos=255;
}
else {
dir=0;
}
}
else {
if(vanePos >0) {
vanePos -=25.5;
if (vanePos<0) vanePos=0;
}
else {
dir=1;
}
}
analogWrite(vntPin, vanePos);
}
Serial.println(analogRead(0));
delay(5);
cnt+=5;
}
Things are looking good. This is my first version of running code. If the frequency is right then it *should* continuously open and close the vanes in 10% increments.. Current I have pin 9 (pwm out pin on the arduino) hooked up to analog in pin 0 which allowed me to read the PWM signal and verify at least that the duty cycle is cycling properly.
#include <avr/interrupt.h>
int vntPin = 9; // LED connected to digital pin 9
int vanePos = 0 ;
int cnt = 0;
int dir = 0;
void setup() {
//graph
Serial.begin(57600);
//140hz 7.1ms ==
TCCR1A = _BV(COM0A0) | _BV(WGM01);
TCCR1B = _BV(CS02) | _BV(CS00);
OCR1A = 222;
}
void loop() {
if (cnt % 1000==0) {
if (dir==1) {
if(vanePos < 255) {
vanePos +=25.5;
if (vanePos>255)vanePos=255;
}
else {
dir=0;
}
}
else {
if(vanePos >0) {
vanePos -=25.5;
if (vanePos<0) vanePos=0;
}
else {
dir=1;
}
}
analogWrite(vntPin, vanePos);
}
Serial.println(analogRead(0));
delay(5);
cnt+=5;
}