want build own dro system? interface arduino igaging or mitutoyo caliper, mic, or scale.
http://arduinotronics.blogspot.com/2015/09/igaging-micrometers-and-calipers.html
http://arduinotronics.blogspot.com/2015/09/igaging-micrometers-and-calipers.html
code: [select]
int req = 5; //mic req line goes pin 5 through q1 (arduino high pulls request line low)
int dat = 2; //mic data line goes pin 2
int clk = 3; //mic clock line goes pin 3
int = 0; int j = 0; int k = 0;
byte mydata[14];
float num;
void setup() {
serial.begin(9600);
pinmode(req, output);
pinmode(clk, input_pullup);
pinmode(dat, input_pullup);
digitalwrite(req,low); // set request @ low
}
void loop() { // data mic
digitalwrite(req, high); // generate set request
for(i = 0; < 13; i++ ) {
k = 0;
for (j = 0; j < 4; j++) {
while( digitalread(clk) == low) {// hold until clock high
}
while( digitalread(clk) == high) {// hold until clock low
}
bitwrite(k, j, (digitalread(dat) & 0x1)); // read data bits, , reverse order )
}
// extract data
mydata[i] = k;
// sign = mydata[4];
// decimal = mydata[11];
// units = mydata[12];
}
// assemble measurement bytes
char buf[7];
for(int lp=0;lp<6;lp++)
buf[lp]=mydata[lp+5]+'0';
buf[6]=0;
num=atol(buf); //assembled measurement, no decimal place added
serial.println(num/1000, 3); //add decimal
}
Arduino Forum > Community > Exhibition / Gallery > Igaging and Mitutoyo Calipers and Micrometers as Input devices
arduino
Comments
Post a Comment