HP Forums
Programming Help - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Programming Help (/thread-12577.html)



Programming Help - ArmoredCow - 03-07-2019 08:25 AM

I'm trying to write a program to help with some Kinematics equations. However I'm new to HP PPL and could use some advice and help on where to get started.

I would like to have it look something like the triangle solver app but when I tried to modify that app I can't get at the code and it just comes off as a clone of the triangle app.

I have some basic code that allows for input of the variables but I'm not sure how to set up a button to start solving for the missing information. Also it would be helpful if I could have the variables set to null so I can tell which ones the user has set and not have them all default to 0.

The very limited code I have is below...
Code:

// Starter Program to help solve Kinematics problems

EXPORT Kinematics()
BEGIN
    INPUT(
    {
    {Vi, [0], {15, 30, 0}},
    {Vf, [0], {65, 30, 0}},
    {Ti, [0], {15, 30, 1}},
    {Tf, [0], {65, 30, 1}},
    {Si, [0], {15, 30, 2}},
    {Sf, [0], {65, 30, 2}},
    {A,  [0], {15, 30, 3}}
    },
    "Kinematics Solver",
    {
    "Vi=", "Vf=",
    "Ti=", "Tf=",
    "Si=", "Sf=",
    " A="
    },
    {
    "Velocity Initial",
    "Velocity Final",
    "Time Initial",
    "Time Final",
    "Position Initial",
    "Position Final",
    "Acceleration"
    },
    {10,20,30,40,50,60,70}
  );
END;



RE: Programming Help - Han - 03-07-2019 07:29 PM

I believe it is not possible to make an interactive INPUT form at the moment. What you can do, however, is allow the user to enter an "S" (you will need to add another allowed type into your INPUT command). Then once the user presses OK or the ENTER key, you can search for which variables has an "S" and solve for those variables.

If you are trying to set up an equation solver, perhaps the solve app might be a better place to start. Clone the solve app, set up your variables and equations, and use the STARTVIEW command to enable the app.

Lastly, if you just want a solver (as opposed to trying out some programming for yourself) that will save your equations, try SolveSys (link in my signature below).

(Don't forget there is a built-in documentation on the calculator itself!)


RE: Programming Help - ArmoredCow - 03-08-2019 06:47 AM

where can I find the documentation on the calculator? And I would love to modify an app but I haven't seen any way to modify the look of the apps.

Are there any tutorials that talk about that somewhere?


RE: Programming Help - Eddie W. Shore - 03-08-2019 01:16 PM

To modify the program associated with the app, press [Shift], [ 1 ]. At the top of the list of programs listed is the app program. That is the one to modify.


The links posted below is a tutorial for custom apps, and built-apps can be customized in a similar way.

Some information of Custom Apps and App Variables:

http://edspi31415.blogspot.com/2018/02/hp-prime-intro-to-blank-custom-apps.html

Examples of Custom Apps:

http://edspi31415.blogspot.com/2018/02/hp-prime-custom-app-geomcalc.html

http://edspi31415.blogspot.com/2018/02/hp-prime-trigplot-app-hp-prime-custom.html

Good luck,

Eddie


RE: Programming Help - rprosperi - 03-08-2019 02:13 PM

(03-08-2019 06:47 AM)ArmoredCow Wrote:  where can I find the documentation on the calculator?

Press Help.

The built-in Help files are quite extensive.


RE: Programming Help - Han - 03-09-2019 12:59 AM

(03-08-2019 02:13 PM)rprosperi Wrote:  
(03-08-2019 06:47 AM)ArmoredCow Wrote:  where can I find the documentation on the calculator?

Press Help.

The built-in Help files are quite extensive.

Just to add some information for those who do not already know: type in a command name, place the cursor at the end of the name (probably works with the cursor anywhere on the command name) and then press Help. This works whether on the command line or inside a program.