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.

asked May 14, 2015 at 14:18
1
  • 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. Commented May 14, 2015 at 14:45

1 Answer 1

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'

Steve Robillard
35k18 gold badges106 silver badges110 bronze badges
answered May 14, 2015 at 15:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.