Hi guys
I am using an android device to send an angle value (between 0 and 10) via bluetooth and receive that data into arduino via the Genotronex library. Every thing works 100% until I uncomment the Genotronex line right at the bottom of the code. When I do that, the servo suddenly seems to jump, jump, jump etc to some weird value every 100 ms. When this line is commented out, the servo performs correctly and goes 100% to the values I am sending from Android. I just cant see hoe the println of the Genotronex can influence the incoming data???
#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial Genotronex(10, 11);
Servo angle_servo;
int servoPin = 9;
int ledpin=13;
char angle;
int motorPin = 0;
int motorSpeed;
int leftPin = 6;
int rightPin = 7;
String string_c;
void setup()
{
Genotronex.begin(9600);
angle_servo.attach(servoPin);
//Serial.begin(9600);
Genotronex.println("Test Data");
pinMode(ledpin,OUTPUT);
pinMode(leftPin,INPUT);
pinMode(rightPin,INPUT);
//pinMode(motorPin, INPUT);
}
void loop()
{
if (Genotronex.available())
{
angle = Genotronex.read();
int temp = angle - 48;
angle_servo.write(temp * 17);
motorSpeed = analogRead(motorPin);
String left = "|0";
String right = "|0";
if(digitalRead(leftPin) == HIGH)
{
left = ",1";
}
else
{
left = ",0";
}
if(digitalRead(rightPin) == HIGH)
{
right = ",1";
}
else
{
right = ",0";
}
string_c = motorSpeed + left + right;
//Genotronex.println(string_c);
}
delay(100);
}
Thanks for any advice!