Author Topic: basic clock program for ti 84 plus  (Read 14168 times)

0 Members and 1 Guest are viewing this topic.

Offline theuserofallusers

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 13
  • Rating: +0/-0
    • View Profile
basic clock program for ti 84 plus
« on: December 21, 2013, 08:16:03 pm »
:ClrHome
:Lbl 1
:For(X,3,16)
:Output(4,X,"<what ever you want>
:For(Y,5,20)
:Output(7,Y,getTime
:Goto 1
:ClrHome

The code makes a loop that updates every time the getTime is displayed,this only shows for about 20-30 seconds and to exit it press the on button.
« Last Edit: August 25, 2014, 03:20:04 pm by theuserofallusers »
I am the User of all users

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: basic clock program for any ti caclulator
« Reply #1 on: December 21, 2013, 08:44:36 pm »
Nice implerrmemtation of a clock.

Offline theuserofallusers

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 13
  • Rating: +0/-0
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #2 on: December 21, 2013, 09:03:42 pm »
Thanks I just got bored in math class and screwed around with the programs....and boom there it is
I need some help to create a more complex one so anyonencan help me, because right now I'm  :banghead:
« Last Edit: December 21, 2013, 09:08:44 pm by theuserofallusers »
I am the User of all users

Offline Hexatron

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +2/-1
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #3 on: December 21, 2013, 09:39:40 pm »
You could use the formula for a circle : (x−h)2+(y−k)2=r2 to draw a line from the center of the graph to the edge of a circle (if that formula i just copypasted works the way I think it does) to represent the current time in (UNITS / 60) / 360.

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #4 on: December 21, 2013, 09:48:45 pm »
What is the purpose of the for loops?

Hexatron: For drawing a line representing the hands of a clock? The implicit equation for a circle would not be helpful in that case. You want the starting and ending point for the line drawing command. The starting point is the center of the circle, and the end is at some point on the edge of the circle at the particular angle. You can use trig to calculate that ending point.
« Last Edit: December 21, 2013, 09:53:42 pm by fb39ca4 »

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: basic clock program for any ti caclulator
« Reply #5 on: December 21, 2013, 09:48:56 pm »
Thanks I just got bored in math class and screwed around with the programs....and boom there it is
I need some help to create a more complex one so anyonencan help me, because right now I'm  :banghead:
Well, to start off, you would obviously need to remove memory leaks. In your program, for example, the two For instructions are unnecessary because you are already looping through Lbl and Goto and Goto-ing from a For/While/Repeat/If block is what causes the memory leak  and error. Even then, While 1:End would be better than Lbl 1-Goto 1 because if the Lbl is lower in the code, then it's much slower to loop than anything else.

Offline theuserofallusers

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 13
  • Rating: +0/-0
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #6 on: December 21, 2013, 11:46:08 pm »
Ill try it later but thanks for all the help I will post my progress when I'm done, btw I'm trying to find a simple basic ti-85 program that displays a bouncing "ball" on the screen any help with that?
« Last Edit: December 21, 2013, 11:46:37 pm by theuserofallusers »
I am the User of all users

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: basic clock program for any ti caclulator
« Reply #7 on: December 22, 2013, 12:56:35 am »
Unfortunately, since the TI-85 has been discontinued in 1997 (before most forum members were even born), there are very few TI-85 owners anymore in the TI community, but its Basic language is pretty similar in general to the TI-84 Plus, so hopefully if you search the forums or Google you might be able to find something helpful. TI-Basic Developer can also help, although it's for the 83+/84+.
« Last Edit: December 22, 2013, 12:56:54 am by DJ Omnimaga »

Offline theuserofallusers

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 13
  • Rating: +0/-0
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #8 on: December 22, 2013, 01:29:56 am »
Wow I did not know that the reason I ask I because I'm going to start a new semester and I was going through my electronics box (I know Nerdy) and found my old ti-85 and I thought well I wounded. Thanks for the help, I'll go and google.
I am the User of all users

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: basic clock program for any ti caclulator
« Reply #9 on: December 22, 2013, 07:40:13 am »
This post is not meant to demotivate you, but I think that it's best to avoid these mistakes when you start making more complex programs.

:ClrHome
:Lbl 1
:For(X,3,16)
:Output(4,X,"<what ever you want>
:For(Y,5,20)
:Output(7,Y,getTime
:Goto 1
:ClrHome

The code makes a loop that updates every time the getTime is displayed,this only shows for about 20-30 seconds and to exit it press the on button.
For loops should be closed by an end. Goto can be used to form a loop, but using a goto to go out of a loop is usually a bad idea. iirc it can even cause a memory leak.

This is how for loops usually work:
Code: [Select]
:For(<variable>,<start>,<end>)
:<do something>
:End
<variable> is a real variable (=uppercase character or one of the variables from the finance app).
At the start of the loop, that variable is set to the <start> value. Then, the code inside the loop is executed. If the variable is smaller than the <end> value, it gets incremented (1 is added to it), and the code in the loop is executed again. This keeps happening untill the variable is greater than or equal to the <end> value.

An other thing that seems slightely inaccurate is that you say in the title that it works on any ti calculator. This is most lickely not true. The lay-out of this code looks like basic for the z80 line (83+/84+ lines), and not all calculators in that line have a clock, so GetTime won't work on all of those calculators (iirc only on the 84+ line (84+, 84+SE and probably also the 84+CSE)).

Anyway, if anything is unclear, feel free to ask about it. This forum has a lot of helpfull members.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

Offline theuserofallusers

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 13
  • Rating: +0/-0
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #10 on: January 22, 2014, 08:58:59 pm »
Thanks that helps, I will post a revised version later
« Last Edit: January 22, 2014, 08:59:37 pm by theuserofallusers »
I am the User of all users

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #11 on: January 22, 2014, 09:40:28 pm »
This is how for loops usually work:
Code: [Select]
:For(<variable>,<start>,<end>)
:<do something>
:End
<variable> is a real variable (=uppercase character or one of the variables from the finance app).
At the start of the loop, that variable is set to the <start> value. Then, the code inside the loop is executed. If the variable is smaller than the <end> value, it gets incremented (1 is added to it), and the code in the loop is executed again. This keeps happening untill the variable is greater than or equal to the <end> value.
TI-BASIC for-loops work slightly differently. (I say after verifying this to make sure I wouldn't make an idiot of myself by incorrectly correcting you x.x)
Namely, when <do something> is finished, first <variable> is incremented, and then if it is less than or equal to <end>, <do something> gets executed again. Only when the incremented <variable> is greater than <end> does the loop end.
Admittedly, this only produces different results in two ways. It loops floor(<end>-<start>)+1 instead of ceil(<end>-<start>)+1 times, which only matters when <end>-<start> is not integral. And <variable> ends up being floor(<end>-<start>)+<start>+1 (equal to floor(<end>)+1 when <start> is integral, and <end>+1 when both are), not ceil(<end>-<start>)+<start> (equal to ceil(<end>) when <start> is integral, and <end> when both are).
TL;DR: for the most common use (<start> and <end> integral, <end> >= <start>), the main difference is that <variable> ends up as <end>+1, not <end>.
(This is likely more detail than is important, and hopefully it's not too confusing to anyone, but it's nice to set the record straight. Naturally, no offense meant to you, ben_g :))
Also, as a reference to UoaU and others who want to read the whole thing and might be slightly confused: ceil/ceiling rounds up to the nearest integer (so ceil(-1.3)=-1, ceil(3)=3, and ceil(4.2)=5) and floor rounds down to the nearest integer (so floor(-1.3)=-2, floor(3)=3, and floor(4.2)=4). An integer is a number without a fractional part (ceil and floor leave these alone).
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline The_King

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 247
  • Rating: +6/-2
  • Ⓣⓗⓔ Ⓖⓐⓜⓔ ⓍⒹ
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #12 on: January 22, 2014, 09:41:48 pm »
note this does not work for nspire series so technically not all ti calculators

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #13 on: January 22, 2014, 09:47:57 pm »
note this does not work for nspire series so technically not all ti calculators
While we're being technical, it should work for the 84+SE emulator that's on some Nspires ;). (Though you could argue it's not an Nspire anymore :P)
Edit:
Thanks that helps, I will post a revised version later
Good luck! I'm sure someone will be able to help you more at that point if you have any questions :)
« Last Edit: January 22, 2014, 09:50:46 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline The_King

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 247
  • Rating: +6/-2
  • Ⓣⓗⓔ Ⓖⓐⓜⓔ ⓍⒹ
    • View Profile
Re: basic clock program for any ti caclulator
« Reply #14 on: January 22, 2014, 10:02:10 pm »
note this does not work for nspire series so technically not all ti calculators
While we're being technical, it should work for the 84+SE emulator that's on some Nspires ;). (Though you could argue it's not an Nspire anymore :P)

however i am having trouble getting a rom for 84 se since wabbitemu for mac does not provide the rom automatically
if u can tell me a way that would be awesome