Boat steering gear. Java Android

Stuck with a problem in your code? Seek help here.

Boat steering gear. Java Android

Postby Mjolinor » September 13th, 2017, 10:54 am

I have been asked by a friend to make a low cost self steering gear for his boat.

I have considered lots of ways that this is possible and have decided:

H bridge driver for DC motor in a satellite dish actuator
ESP8266 (ESP 12 or 7, because I have some)

Now here I thought that I could stick a magnetometer chip with the ESP but figure that Android phones have all that already so it may be the best way forward is to make an AP with the ESP and just send "bearing" every few seconds / minutes or whatever is necessary using port 80 into the ESP. The ESP would then decide if the compass in the phone was pointing North and if not which way to turn. Course would be set by just setting the boat on the heading required then placing the phone so that it pointed North. Simple :)

So off I go in search of Android programming. :( I end up with Androidstudio as it seems to be what other people mostly use.

I now reach the point where I think that Androidstudio is a joke and surely no one can take it seriously. I cannot make sense of it at all. Who decided that it was sensible to stick strings in their own file rather than where they were needed so you have to search at least two files in order to find where statements came from. How can a "hello world" example need 1,200 files.

Either road up it still seems to be the sensible way forward so off I go doing some tutorials and all of them seem to think I want to drag boxes about and draw lines in a graphical interface. Who cares what it looks like, certainly not I.

I found an application that is exactly what I need. A simple compass application and downloaded the dev version of it following advice from the author.

In this there is the main file ( and if it is successful getting a reading then it does this:
public void onNewAzimuth(float azimuth) {
Log.d(TAG, "will set rotation from " + currentAzimuth + " to "
+ azimuth);

Animation an = new RotateAnimation(-currentAzimuth, -azimuth,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
currentAzimuth = azimuth;



So it seems that the number I need is stored in "azimuth"

Can anyone please tell me how to print that to the screen? I have tried several dozen different ways of adding a text box to activity_compass.xml . I can add the text box and stick some text in it no problem but getting a variable to appear in there seems to be not possible by someone with my little brain.
Posts: 231
Joined: July 30th, 2013, 10:05 am
Location: Burnley, UK

Return to Help Me! Software

Who is online

Users browsing this forum: No registered users and 1 guest