i am working on a cnc machinge that uses a probe to determing its location in a 3d space. ive worked out how to control the probe wirelessly with two arduinos. One being a sender and the other a receiver. However, i have been using a 355/415 MHZ radio transceiver and the lag between communication is 16-32ms long which is too long i need sub 10ms. This could be my code which i will post but i think its the devices.
I am looking for a module that is preferably linked together because i will have multiple cnc machines going at once and i dont need false triggers. ive been leaning towards infared but i accidentally purchased two pin IR sender/receiver parts and they wont do the job i believe
TRANSMIT ATTINTY85
#include <RCSwitch.h>
#define Blink 0
RCSwitch mySwitch = RCSwitch();
void setup() {
pinMode(Blink, OUTPUT);
digitalWrite(Blink, HIGH);
mySwitch.enableTransmit(1); // Using Pin #10
//Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A3);
while(sensorValue == 0){
digitalWrite(Blink, LOW);
mySwitch.send("0001");
//Serial.println("sent");
// digitalWrite(Blink, HIGH);
sensorValue = analogRead(A3);
}
digitalWrite(Blink, HIGH);
mySwitch.send("1000");
}
RECEIVER USING ARDUINO UNO
#include <RCSwitch.h>
/*
Simple example for receiving
http://code.google.com/p/rc-switch/
Need help? http://forum.ardumote.com
*/
#define ENABLE 5
RCSwitch mySwitch = RCSwitch();
int x = 0;
int i;
int y;
void setup() {
Serial.begin(230400);
mySwitch.enableReceive(0); // Receiver on inerrupt 0 => that is pin #2
pinMode(ENABLE,OUTPUT);
digitalWrite(ENABLE,HIGH); // enable on
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
while (value == 1) {
digitalWrite(ENABLE,LOW); // enable on
Serial.println("Recieved");
// delay(500);
//
// digitalWrite(ENABLE,HIGH); // disable
value = mySwitch.getReceivedValue();
}
digitalWrite(ENABLE,HIGH); // disable
}
mySwitch.resetAvailable();
}