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.
}
fdserial_rxChar()
or similar. So what is your actual problem? You eon't get good answers if you don't ask an understandable and complete questionim sending the value 1500
... what does that mean? ... are you sending a integer? ... are you sending text? ... something other?