What it's supposed to do is when I press down on the joystick, the motor activates. What it does instead is it gives me this in the serial monitor: CýÐH“ I“.«�±C°H“ I“.«�¹C°�þ¹C°�Hee`I“
Here's My code, plz help
-----------------------------------------------------------------------------------------------------------
int motorPin1 = 3;
int UD = 0;
int LR = 0;
int IUP = A1;
int ILR = A0;
int MID = 10;
int LRMID = 0;
int UPMID = 0;
void setup()
{
pinMode(motorPin1, OUTPUT);
Serial.begin(9600);
while (! Serial);
Serial.println("Speed 0 to 255");
LRMID = analogRead(ILR);
UPMID = analogRead(IUP);
}
void loop()
{
if (Serial.available())
{
int speed = Serial.parseInt();
if (speed >= 0 && speed <= 255)
{
analogWrite(motorPin1, speed);
}
}
UD = analogRead(IUP);
LR = analogRead(ILR);
if(MID > UD + LR)
{
Serial.println(0);
}
else
{
if(UD < UPMID - MID) //Down
{
Serial.println(163);
}
}
}