0

I'm developing an Android application to control a RC car. I have a Raspberry Pi 2 running a Python script successfully controlling the motors moving the car. When I connect with Putty I am able to run my script with the command sudo python /home/pi/Car.py
The script itself is running an infinite loop waiting for user input - press w to go forward, s goes backwards etc. So basically two step command: 1. Start the python script 2. Input commands for the movement e.g. w w w s a w d.

The communication from the Android app to the Raspberry is done via the JSch library and my app successfully establishes connection. The problem is when I'm trying to run the second command, for the movement itself - seems like the script is not running and is not reading the value sent.

Do you have any suggestions what could be the reason for this, any ideas for fixes in the implementation of the python script maybe, I could provide source code if needed.

  • unless the object of the exercise is to write an android app (or even if it is) to debug why don't you install an SSH app on the android device. This will let you determine if your app is the problem. – Steve Robillard May 14 '15 at 14:45
2

There is no 'second command' it's just input for the first command.

So be sure you use

channel.setInputStream(myio);

And write wwsawd to 'myio'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.