I wrote this simple script to control a servo over serial comm -
#include <Servo.h>
Servo steeringServo;
char data = ' ';
void setup() {
steeringServo.attach(9);
Serial.begin(115200);
}
void loop() {
if(Serial.available()){
data = Serial.read();
}
if(data =='L'){
steeringServo.write(50);
}
else if(data == 'R'){
steeringServo.write(135);
}
else if(data == 'S'){
steeringServo.write(90);
}
}
It was working fine, I was sending values through a python script(attached capacitor between GND and RESET pins) and the Serial Monitor as well. I turned my Arduino off and after a while I come back and reconnect all stuff exactly the way it was, but now my Arduino isn't responding! I tried sending values through the serial monitor to the above sketch but nothing happens! I tried another code which takes values over serial comm and that didn't work as well. The Arduino just receives the values but doesn't do what its supposed to when it receives. The RX LED flashes for a second and that's it.
I tried sending values through my script. Works perfectly fine.
What has gone wrong with my Arduino?
EDIT:
Tried putty to send values over serial connection, works perfectly.