Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 05:08 19 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : PicoMite "Analogue Clock"

     Page 3 of 3    
Author Message
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5705
Posted: 06:32pm 31 Aug 2022
Copy link to clipboard 
Print this post

@stanleyella
That's just proof that you have a larger monitor than the one I'm using, Stan, and better eyes! I couldn't fit that much text on my screen and have it anywhere close to readable. It doesn't illustrate the point that using that editor removes any confusing errors that you see when testing hardware that you aren't familiar with though. When you are in that situation and you want help with it it doesn't matter how pretty your editor is.

MMBasic is supported using the built-in editor and Tera Term under Windows 10/11. If you have a problem and are using a different setup then you should revert to that until it's proved that your hardware is ok. If you still have a problem when you go back to your favourite setup then it's your setup that's at fault - and that's not supported as part of MMBasic.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1639
Posted: 07:44pm 31 Aug 2022
Copy link to clipboard 
Print this post

  lizby said  Copy/paste is a doodle with TeraTerm plus Notepad++ (or the text editor of your choice) plus F10/AUTOSAVE. MMEdit saves you a few keystrokes (or mouse moves and clicks if you prefer), but that just amounts to a few seconds per edit/run cycle--not enough for me to feel restricted in my programming flow.

Not saying it's "better"--just approximately equivalent and well-suited to my development style. (From someone who endured 4-hour (or more) turnarounds with punched cards, to 5-minute edit/compile/run cycles on CP/M machines, to one F-key cycles between edit and run with the MMBasic editor.)


It is a doddle in mmedit. Just using mmedit I learnt lots about mmbasic I would not have otherwise. It is a download on geoff's picomite download page.

I remember ps2 mice with a ball. times change. wifi/blue tooth laser now.
My wife worked in the university processing punch cards early 70's. student code.

I digress. I am glad there is the mmedit option for coding. it nearly works out the box. The connect to not your lcd or not your pico is strange and values sent to chat??
I would like to get mmbasic new users because it is worth it and cheap hardware and free software. I would not want them to experience my problems, only happy sailing.
It was called plug'n'play and mmbasic can be. No need for forum advice.
Hope mmbasic gets new picomite users.
 
DrifterNL

Regular Member

Joined: 27/09/2018
Location: Netherlands
Posts: 56
Posted: 08:25pm 01 Sep 2022
Copy link to clipboard 
Print this post

  TassyJim said  Apologies to DrifterNL, Your analogue clock is an useful demonstration of MMBasics floating point abilities as well as it's graphics.
Sorry for the diversion.

Jim


Thank you and no problem. It's amazing where a thread can sometimes lead to lol.
Floating Point Keeps Sinking Me!
Back To Integer So I Don't Get Injured.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 1639
Posted: 09:35pm 01 Sep 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  Stan...
Windows has a driver that creates virtual COM ports for USB devices. When it finds an unrecognised device it gives it the next available COM port number based on the devices reported ID. It keeps a record of these and will (usually) give the same USB device the same COM port number next time it is attached.

Tera Term doesn't see USB devices, it sees the COM ports that Windows has created. When you connect a Pico it reports it's ID to Windows which then looks up its record and allocates the same COM port that it used for that Pico last time.

Some terminal programs don't do that. You have to allocate a virtual or physical COM port to a device.

The built in editor requires one Fkey press to "flash code". Is the mouse glued onto your hand? Use the other one. :)  Also, using the built-in editor, when you power up the program is already there where you left it, ready for editing. Press one Fkey and you switch from the command line to the editor.  

As for using MMEdit without bothering to read the manual....   [/QUOTE
I get the same "problem" with lgt328 in another basic. win 10 it has a port "name" not com xx but dim problemio. (Welsh) (it all ends happy ever etc.)

the mouse is glued sir :) , is your vga a big crt monitor? :)
just jokin sir :)

MMedit is Soooo Eeeeeasy it does not need a manual,  just get on with coding.,,,Yeah.
That is going to annoy some folk but I do not care. Well I do but it is a free world and notice I do not use abbreviations anymore because I have been learning English and new words like sarcasm.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8566
Posted: 09:50pm 01 Sep 2022
Copy link to clipboard 
Print this post

Nobody cares whether you use MMEDIT or not - lots of us do. We only complain when you ask for help and your question is confused in a mess of MMEDIT/MMBASIC when a screen snapshot of Teraterm, code properly presented, and your options listed and which firmware you are using would help us properly understand the issue in a fraction of the time that previous issues have taken
Edited 2022-09-02 07:52 by matherp
 
DrifterNL

Regular Member

Joined: 27/09/2018
Location: Netherlands
Posts: 56
Posted: 11:36pm 06 Sep 2022
Copy link to clipboard 
Print this post

oops delete post
Edited 2022-09-07 09:40 by DrifterNL
Floating Point Keeps Sinking Me!
Back To Integer So I Don't Get Injured.
 
DrifterNL

Regular Member

Joined: 27/09/2018
Location: Netherlands
Posts: 56
Posted: 12:01am 07 Sep 2022
Copy link to clipboard 
Print this post

I played around (tweaked) the code after reading the manual and a few threads here.

'Ananlogue Clock for PicoMite / 2022'
'Raspberry Pi Pico running MMBasic interpreter (PicoMite)'
'Uses an I2C RTC connected to the PicoMite system I2C bus'
'and SPI based Display Panel'
'System time is set from I2C RTC at first run and can be'
'set from I2C RTC anytime after by pressing "s"'
'Clock is customizable with colours, location and dimensions.'

Option explicit

'----------variables----------'
Dim cr,cd,dd
Dim xc,yc,x1,y1,x2,y2
Dim xh,yh,xm,ym,xs,ys
Dim xho,yho,xmo,ymo,xso,yso
Dim hour,min,sec
Dim csl,hhl,mhl,shl
Dim chc,shc
Dim ot$

'----------clock colours----------'
Const ccc = RGB(orange)  'clock circle colour'
Const csc = RGB(orange)  'clock spoke colour'
Const hmamc = RGB(green) 'hour and minute hand am colour'
Const hmpmc = RGB(blue)  'hour and minute hand pm colour'
Const shamc = RGB(red)   'second hand am colour'
Const shpmc = RGB(red)   'second hand pm colour'
Const clsc = RGB(black)  'clear screen colour'

'----------clock location and dimensions----------'
xc = MM.HRes / 2 'clock x center'
yc = MM.VRes / 2 'clock y center'
cr = Min(MM.HRes , MM.VRes) / 2 - 15 'clock radius'
csl = cr * 0.05 'clock spoke length'
hhl = cr * 0.5  'hour hand length'
mhl = cr * 0.9  'minute hand length'
shl = cr * 0.9  'second hand length'

'----------setting variables for first run----------'
xho = xc
yho = yc
xmo = xc
ymo = yc
xso = xc
yso = yc

'----------clearing the display----------'
CLS clsc

'----------clock circle----------'
Circle xc,yc,cr,1,1,ccc'

'----------clock spokes----------'
For dd = 0 To 360 Step + 30
x1 = Fix(Sin(Rad(dd)) * (cr))
y1 = Fix(Cos(Rad(dd)) * (cr))
x2 = Fix(Sin(Rad(dd)) * (cr+csl))
y2 = Fix(Cos(Rad(dd)) * (cr+csl))
Line x1+xc,y1+yc,x2+xc,y2+yc,1,csc
Next

'----------set time from I2C RTC----------'
settime:
RTC gettime
If Val(Mid$(Time$,7,2)) = 0 Then GoTo settime

'----------the clock----------'
clockloop:

'----------press "s" anytime to set time from I2C RTC----------'
If Inkey$ = "s" Then GoTo settime

'----------get time values from time string----------'
ot$ = Time$
hour = Val(Mid$(ot$,1,2))
min = Val(Mid$(ot$,4,2))
sec = Val(Mid$(ot$,7,2))

'----------set clock hand colours for am or pm----------'
If hour >= 12 Then
 chc = hmpmc
 shc = shpmc
Else
 chc = hmamc
 shc = shamc
EndIf

'----------hour hand location----------'
'24 hour to 12 hour for 360 degrees'
If hour > 12 Then
 cd = (30 * (hour - 12)) + (0.5 * (Fix(min / 10) * 10))
 Else
 cd = (30 * hour) + (0.5 * (Fix(min / 10) * 10))
EndIf
dd = cd + 180
If dd > 360 Then dd = dd - 360
dd = 360 - dd
xh = Fix(Sin(Rad(dd)) * hhl)
yh = Fix(Cos(Rad(dd)) * hhl)

'----------minute hand location----------'
cd = (6 * min) + (0.1 * (Fix(sec / 10) * 10))
dd = cd + 180
If dd > 360 Then dd = dd - 360
dd = 360 - dd
xm = Fix(Sin(Rad(dd)) * mhl)
ym = Fix(Cos(Rad(dd)) * mhl)


'----------second hand location----------'
cd = 6 * sec
dd = cd + 180
If dd > 360 Then dd = dd - 360
dd = 360 - dd
xs = Fix(Sin(Rad(dd)) * shl)
ys = Fix(Cos(Rad(dd)) * shl)

'------clear old and display new clock hands on SPID------'
If (xho <> xh) Or (yho <> yh) Then
 Line xc,yc,xho+xc,yho+yc,1,clsc
EndIf
If (xmo <> xm) Or (ymo <> ym) Then
 Line xc,yc,xmo+xc,ymo+yc,1,clsc
EndIf
If (xso <> xs) Or (yso <> ys) Then
 Line xc,yc,xso+xc,yso+yc,1,clsc
EndIf

Line xc,yc,xh+xc,yh+yc,1,chc
Line xc,yc,xm+xc,ym+yc,1,chc
Line xc,yc,xs+xc,ys+yc,1,shc

'-------save old data for clearing clock hands on next round-------'
xho = xh
yho = yh
xmo = xm
ymo = ym
xso = xs
yso = ys

GoTo clockloop

Floating Point Keeps Sinking Me!
Back To Integer So I Don't Get Injured.
 
Zett

Newbie

Joined: 18/06/2022
Location: Netherlands
Posts: 14
Posted: 01:22pm 27 Sep 2023
Copy link to clipboard 
Print this post



used your code to make this. D:
 
DrifterNL

Regular Member

Joined: 27/09/2018
Location: Netherlands
Posts: 56
Posted: 09:16pm 27 Sep 2023
Copy link to clipboard 
Print this post

  Zett said  

used your code to make this. D:


Looks great!
Floating Point Keeps Sinking Me!
Back To Integer So I Don't Get Injured.
 
     Page 3 of 3    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024