Author Topic: TimeTools  (Read 6523 times)

0 Members and 1 Guest are viewing this topic.

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
TimeTools
« on: November 14, 2010, 06:06:48 am »
TimeTools is a small TI-BASIC program I've been working on for a while. It displays the current time (both digital and analog display), and also has a timer that has the ability to continue even when TimeTools is not running. It only runs on TI-84+(SE) since the clock is used.
I've tried to optimize this as much as I could. The screen is only updated when needed, and the whole program is about 1 kB. Usually, it runs at about 5 FPS.




http://www.ticalc.org/archives/files/fileinfo/433/43347.html
« Last Edit: April 20, 2011, 03:45:27 am by JosJuice »

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: TimeTools
« Reply #1 on: November 14, 2010, 10:20:42 am »
The hands are done via sin( and cos( in degree mode.  At zstandard, Lsin(A) gives the y coordinate for a hand L long and at the angle A.  A goes from 0-360, so for the second hand, it goes 60 times in a minutes or 360 degrees, which means it goes 1 time in a second or 360/60=60 degrees.  Also note that the pair (cos(0),sin(0)) produces (1,0) which means that you are going to have to shift the degrees by 90.  So that way, at 0 seconds, it would be (cos(0+90),sin(0+90)) which is (0,1) the correct start of the clock.  To have an offset, just add the x and y coordinates outside the sine and cosine.  Also note that that click will go counterclockwise, so you must negate the entire angle measure inside the cos( and sin( brackets.  Good luck. I would try a simple clock the size of the screen first, though.
« Last Edit: November 14, 2010, 10:21:12 am by graphmastur »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: TimeTools
« Reply #2 on: November 14, 2010, 11:28:21 am »
Also note that the pair (cos(0),sin(0)) produces (1,0) which means that you are going to have to shift the degrees by 90.  So that way, at 0 seconds, it would be (cos(0+90),sin(0+90)) which is (0,1) the correct start of the clock.

Actually, that would make it go backwards (counterclockwise). An easier (and smaller) way to do it is sin( for X and cos( for Y.

This project looks pretty nice, especially for a first project. 5 FPS is a pretty good speed for BASIC :D

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: TimeTools
« Reply #3 on: November 14, 2010, 01:05:09 pm »
Interesting, I'm curious how this will turn out. :)

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: TimeTools
« Reply #4 on: November 17, 2010, 10:02:54 am »
I've managed to draw the hands of the clock, but everything isn't done yet. I need to make the hands I drew the previous minute disappear, and some other stuff :P
Is it possible to recall a Pic when in Horiz mode? It doesn't seem to work for me.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: TimeTools
« Reply #5 on: November 17, 2010, 10:34:59 am »
It should work, but it only shows the top half. The bottom half gets cut off, unfortunately.




Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TimeTools
« Reply #6 on: November 17, 2010, 12:59:48 pm »


Looks great, so, we need to set time i the 'Mode' button before using the program?

EDIT: Just tried it in Wabbit, yes we do, indeed, maybe add an option for us to set time, if possible?

EDIT2: Also, it displays "ednesday" instead of "Wednesday" :s
« Last Edit: November 17, 2010, 01:01:46 pm by ScoutDavid »

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: TimeTools
« Reply #7 on: November 17, 2010, 01:06:55 pm »
If you want to set the time, then you can use the setTime( command in TI-OS. It takes Hour, minute, and second as the arguments. You might just want to trim it to Hour and minute.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TimeTools
« Reply #8 on: November 17, 2010, 01:07:42 pm »
If you want to set the time, then you can use the setTime( command in TI-OS. It takes Hour, minute, and second as the arguments. You might just want to trim it to Hour and minute.

I prefer to go to Mode :), it's much simpler and lets tou set date format and everything!

ASHBAD_ALVIN

  • Guest
Re: TimeTools
« Reply #9 on: November 17, 2010, 01:26:31 pm »
If you want to set the time, then you can use the setTime( command in TI-OS. It takes Hour, minute, and second as the arguments. You might just want to trim it to Hour and minute.

I prefer to go to Mode :), it's much simpler and lets tou set date format and everything!

This looks better in my opinion :P

I see how you have decent timer controls in there, great, becuase I used to have to make a BASIC program every time I wanted to use a timer function.  And even then, that timer isn't fully accurate.

Great work so far!  Keep up the great work!  When it's finished I will probably put it on my real calc too ;)

NOOO I DON'T HAVE 666 POSTS ANYMOREZ :( I HAD THART FOR ONE WHOLE DAY TOO :P

EDIT: and 5 fps is fine for a BASIC prog.  if it were asm however, we'd be expecting a fps of >9000.  ;)
« Last Edit: November 17, 2010, 01:29:12 pm by ASHBAD_ALVIN »

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: TimeTools
« Reply #10 on: November 17, 2010, 01:29:58 pm »
If you want to set the time, then you can use the setTime( command in TI-OS. It takes Hour, minute, and second as the arguments. You might just want to trim it to Hour and minute.

I prefer to go to Mode :), it's much simpler and lets tou set date format and everything!

The setTime( and the SetDate( functions are the same ones that TI-OS uses in the Mode menu :P
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline JosJuice

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1344
  • Rating: +66/-14
    • View Profile
Re: TimeTools
« Reply #11 on: November 17, 2010, 01:36:55 pm »
I fixed the ednesday glitch earlier today (didn't notice it earlier, because the current screen erasing routine was written on Thursday last week...) The fix isn't uploaded yet, though (TI-Connect refuses to connect with my calc right now).

Also, adding an option to set the time might be a bit tricky. The code is not designed for going to a second screen while the program is running and then go back, but I'll see if it's possible to make something anyway.

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: TimeTools
« Reply #12 on: November 17, 2010, 03:26:21 pm »
I fixed the ednesday glitch earlier today (didn't notice it earlier, because the current screen erasing routine was written on Thursday last week...) The fix isn't uploaded yet, though (TI-Connect refuses to connect with my calc right now).

Also, adding an option to set the time might be a bit tricky. The code is not designed for going to a second screen while the program is running and then go back, but I'll see if it's possible to make something anyway.

Great, hope you can make it, though!

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: TimeTools
« Reply #13 on: November 18, 2010, 01:31:28 am »
This is sounding and looking great :) Great job!

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: TimeTools
« Reply #14 on: November 18, 2010, 01:09:27 pm »
This looks cool.  Good luck getting 'settime' to work. :)