Skip to main content
formatted code
Source Link
jsotola
  • 1.6k
  • 2
  • 13
  • 22

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    // send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  // send Lower 7 bits

and was receiving it with code that looked like this

    servo1  = fdserial_rxChar(receive) << 7;     // get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  // get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {
// physical pin 2=TX 3=RX  
  Serial.begin(9600);
  pinMode(3, OUTPUT);      // set LED pin as output
  digitalWrite(3, LOW);    // switch off LED pin
}

void loop() {
  
  if (Serial.available()) {
  //  char data_rcvd = Serial.read();   // read one byte from serial buffer and save to data_rcvd

    int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
    int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




    if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
    if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off
  }

//  if (digitalRead(8) == HIGH) Serial.write('0');    // send the char '0' to serial if button is not pressed.
//  else Serial.write('1');                           // send the char '1' to serial if button is pressed.

}

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {
// physical pin 2=TX 3=RX  
  Serial.begin(9600);
  pinMode(3, OUTPUT);      // set LED pin as output
  digitalWrite(3, LOW);    // switch off LED pin
}

void loop() {
  
  if (Serial.available()) {
  //  char data_rcvd = Serial.read();   // read one byte from serial buffer and save to data_rcvd

    int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
    int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




    if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
    if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off
  }

//  if (digitalRead(8) == HIGH) Serial.write('0');    // send the char '0' to serial if button is not pressed.
//  else Serial.write('1');                           // send the char '1' to serial if button is pressed.

}

im sending the value 1500 from another MCU with

 fdserial_txChar(transmit, send >> 7);    // send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  // send Lower 7 bits

and was receiving it with code that looked like this

servo1  = fdserial_rxChar(receive) << 7;    // get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  // get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {
// physical pin 2=TX 3=RX  
  Serial.begin(9600);
  pinMode(3, OUTPUT);      // set LED pin as output
  digitalWrite(3, LOW);    // switch off LED pin
}

void loop() {
  
  if (Serial.available()) {
  //  char data_rcvd = Serial.read();   // read one byte from serial buffer and save to data_rcvd

    int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
    int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




    if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
    if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off
  }

//  if (digitalRead(8) == HIGH) Serial.write('0');    // send the char '0' to serial if button is not pressed.
//  else Serial.write('1');                           // send the char '1' to serial if button is pressed.

}
added 100 characters in body
Source Link
chrisl
  • 16.6k
  • 2
  • 18
  • 27

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {

// physical pin 2=TX 3=RX
Serial.begin(9600); pinMode(3, OUTPUT); // set LED pin as output digitalWrite(3, LOW); // switch off LED pin }

void loop() {

if (Serial.available()) { // char data_rcvd = Serial.read(); // read one byte from serial buffer and save to data_rcvd

// physical pin 2=TX 3=RX  
  Serial.begin(9600);
  pinMode(3, OUTPUT);      // set LED pin as output
  digitalWrite(3, LOW);    // switch off LED pin
}

void loop() {
  
  if (Serial.available()) {
  //  char data_rcvd = Serial.read();   // read one byte from serial buffer and save to data_rcvd

    int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
    int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




    if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
    if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off
  }

//  if (digitalRead(8) == HIGH) Serial.write('0');    // send the char '0' to serial if button is not pressed.
//  else Serial.write('1');                           // send the char '1' to serial if button is pressed.

}

}

// if (digitalRead(8) == HIGH) Serial.write('0'); // send the char '0' to serial if button is not pressed. // else Serial.write('1'); // send the char '1' to serial if button is pressed.

}

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {

// physical pin 2=TX 3=RX
Serial.begin(9600); pinMode(3, OUTPUT); // set LED pin as output digitalWrite(3, LOW); // switch off LED pin }

void loop() {

if (Serial.available()) { // char data_rcvd = Serial.read(); // read one byte from serial buffer and save to data_rcvd

int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off

}

// if (digitalRead(8) == HIGH) Serial.write('0'); // send the char '0' to serial if button is not pressed. // else Serial.write('1'); // send the char '1' to serial if button is pressed.

}

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {
// physical pin 2=TX 3=RX  
  Serial.begin(9600);
  pinMode(3, OUTPUT);      // set LED pin as output
  digitalWrite(3, LOW);    // switch off LED pin
}

void loop() {
  
  if (Serial.available()) {
  //  char data_rcvd = Serial.read();   // read one byte from serial buffer and save to data_rcvd

    int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
    int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




    if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
    if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off
  }

//  if (digitalRead(8) == HIGH) Serial.write('0');    // send the char '0' to serial if button is not pressed.
//  else Serial.write('1');                           // send the char '1' to serial if button is pressed.

}
added 889 characters in body
Source Link

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {

// physical pin 2=TX 3=RX
Serial.begin(9600); pinMode(3, OUTPUT); // set LED pin as output digitalWrite(3, LOW); // switch off LED pin }

void loop() {

if (Serial.available()) { // char data_rcvd = Serial.read(); // read one byte from serial buffer and save to data_rcvd

int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off

}

// if (digitalRead(8) == HIGH) Serial.write('0'); // send the char '0' to serial if button is not pressed. // else Serial.write('1'); // send the char '1' to serial if button is pressed.

}

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

im sending the value 1500 from another MCU with

     fdserial_txChar(transmit, send >> 7);    //send Higher 7 bits
 fdserial_txChar(transmit, send & 0x7F);  //send Lower 7 bits

and was receiving it with code that looked like this

    servo1 = fdserial_rxChar(receive) << 7;     //get Higher 7 bits
servo1 += fdserial_rxChar(receive) & 0x7F;  //get and add Lower 7 bits

how do i rewrite the receiving code so arduino will compile it?

Thank you.

here is the code im trying to get working

void setup() {

// physical pin 2=TX 3=RX
Serial.begin(9600); pinMode(3, OUTPUT); // set LED pin as output digitalWrite(3, LOW); // switch off LED pin }

void loop() {

if (Serial.available()) { // char data_rcvd = Serial.read(); // read one byte from serial buffer and save to data_rcvd

int data_rcvd = Serial.read() << 7;     //get Higher 7 bits
int data_rcvd += Serial.read() & 0x7F;  //get and add Lower 7 bits




if (data_rcvd == 1500) digitalWrite(3, HIGH); // switch LED On
if (data_rcvd == '0') digitalWrite(3, LOW);  // switch LED Off

}

// if (digitalRead(8) == HIGH) Serial.write('0'); // send the char '0' to serial if button is not pressed. // else Serial.write('1'); // send the char '1' to serial if button is pressed.

}

Source Link
Loading