Plugged my ancient Raspberry Pi in to my router (yeah the original, that doesn’t have on board wifi) and wanted to SSH into it, found this command to easily show you what devices are on your network, listing the IP address and the hostname
nmap -sL 192.168.1.* | grep \(1
Nmap scan report for D-Link.Home (192.168.1.1)
Nmap scan report for envoy (192.168.1.3)
Nmap scan report for Jamess-MBP (192.168.1.4)
Nmap scan report for LGSmartTV (192.168.1.5)
Nmap scan report for MeaganAir (192.168.1.9)
Nmap scan report for LGwebOSTV (192.168.1.10)
Nmap scan report for Meagans-iPhone (192.168.1.12)
Nmap scan report for retropie (192.168.1.13)
There we go, last one on the list. The piping to grep just filters out addresses that are in use, otherwise it’d list all 255 addresses.
Continuing on from my previous post, I’ve created an android client that I can use to send commands to my python server.
Ultimately I want to be able to control the robot remotely, the best way to do this would be to control the robot from a tablet or a phone which communicates wirelessly with the pi via bluetooth or wifi. In my previous post I described setting up a python application that will run on the raspberry pi and listen for commands. All I needed to do was to create a very basic android interface that can send commands to the raspberry pi.
The robot I intend to build will be based on tracks instead of wheels, there are many benefits to this but the most significant is that from an engineering perspective is that its much easier to build. A car needs forward and backwards drive, but also sideways drive for the front axle. In my opinion, it is far simpler to have a tracked vehicle with a motor controlling each side. When both motors are turned in the same direction the vehicle moves forward or backwards, and when the motors run in opposite directions the vehicle will turn on the spot.
My app interface mimics the layout of the vehicle itself, with an up and down button on the left and right hand side of the screen, as shown below.
You can see the code for this layout on the github repo here.
I want the user to be able to hold a button and the motor will run until they take their finger off. For this I’ve attached listeners on the buttons that will listen for the key up and key down events. It will send separate events for starting and stopping the motors, like so: