I have the code for a H bridge and the code to use serial but i dont know how to combine them so like if i send FORWARD to serial the motors will rotate. here is my serial code:
void setup(){
Serial.begin(9600);
}
void loop(){
//check to see if anything is available in the serial recive buffer
while (Serial.available() > 0)
{
// create a place to hold the incomeing message
static char message[MAX_MESSAGE_LENGTH];
static unsigned int message_pos = 0;
//Read the next avalible byte in the serial buffer
char inByte = Serial.read();
//Message comeing in (check not terminarteing char)
if (inByte != '\n' &&(message_pos < MAX_MESSAGE_LENGTH - 1))
{
message[message_pos] = inByte;
message_pos++;
}
else
{
message[message_pos] = '\0';
Serial.println(message);
message_pos = 0;
}
}
}