最近想將arduino 轉 labview
但是效果不太一樣
x9c102-103-104-503.pdf (617.7 KB)
以下為-----------labview--------------------------------
void down - 複製.vi (25.9 KB)
void up - 複製.vi (25.9 KB)
以下為-----------arduino --------------------------------
#define UD 2 // OUTPUT
#define INC 3
#define CS 4
void up(){
digitalWrite(UD, HIGH);
digitalWrite(INC, HIGH);
digitalWrite(CS, LOW); // turn on the microcircuit
delayMicroseconds(1);
digitalWrite(INC, LOW);
delayMicroseconds(1);
digitalWrite(INC, HIGH);
delayMicroseconds(1);
///digitalWrite(INC, LOW); // in this case the position of the slider is not written
digitalWrite(CS, HIGH); // turn off the chip and write the position in the EEPROM
}
void down(){
digitalWrite(UD, LOW);
digitalWrite(INC, HIGH);
digitalWrite(CS, LOW);
delayMicroseconds(1);
digitalWrite(INC, LOW);
delayMicroseconds(1);
digitalWrite(INC, HIGH);
delayMicroseconds(1);
digitalWrite(CS, HIGH);
}
void setup() {
Serial.begin(9600);
pinMode(INC, OUTPUT);
pinMode(UD, OUTPUT);
pinMode(CS, OUTPUT);
digitalWrite(CS, HIGH); // turn off the microcircuit
}
void loop() {
if (Serial.available())
if (Serial.read() == '0'){
down();
Serial.print("-1");
}
else {
up();
Serial.print("+1");
}
}
請問我該如何改?
謝謝