I am using the teensy 4.1 to comunicate via rs-485 with arduino mega.
I have two sketches one without a timer that works, and other with timer that doesn't wo
In this code the arduino don't recive the data. But yes without the rs-485 perhiperal
And with this code the Arduino receives the data.
For now I don't have an oscilloscope to see the data is sent.
Any suggestions?
I have two sketches one without a timer that works, and other with timer that doesn't wo
Code:
IntervalTimer myTimer;
void setup() {
// put your setup code here, to run once:
Serial2.begin(500000);
pinMode(2,OUTPUT);
myTimer.begin(mainTimer,20000);
}
void loop() {
// put your main code here, to run repeatedly:
}
void mainTimer(){
static byte data[]={11,1,12};
digitalWrite(2,HIGH);
Serial2.write(data,3);
digitalWrite(2, LOW);
}
In this code the arduino don't recive the data. But yes without the rs-485 perhiperal
Code:
IntervalTimer myTimer;
void setup() {
// put your setup code here, to run once:
Serial2.begin(500000);
pinMode(2,OUTPUT);
myTimer.begin(mainTimer,20000);
}
void loop() {
static byte data[]={11,1,12};
digitalWrite(2,HIGH);
Serial2.write(data,3);
digitalWrite(2, LOW);
// put your main code here, to run repeatedly:
}
void mainTimer(){
}
And with this code the Arduino receives the data.
For now I don't have an oscilloscope to see the data is sent.
Any suggestions?