Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 17:12 12 Nov 2025 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 : Scrolling text

Author Message
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:46pm 15 Feb 2019
Copy link to clipboard 
Print this post

Is it possible to have scrolling text on an SSD1963 display?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10572
Posted: 10:51pm 15 Feb 2019
Copy link to clipboard 
Print this post

  Quote  Is it possible to have scrolling text on an SSD1963 display?


Need more specific question, left/right? , up/down?, overlaying background? platform?
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:44am 16 Feb 2019
Copy link to clipboard 
Print this post

Sorry I should have been more specific
Right to Left no picture just a background colour
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10572
Posted: 10:19am 16 Feb 2019
Copy link to clipboard 
Print this post

I assume Pi-cromite?

FONT 4
option autorefresh off
a$="Hello world, this is a test of right to left scrolling. "
do
for i=0 to -mm.fontwidth*len(a$) step -1
text i,0,a$
text i+mm.fontwidth*len(a$),0,a$
refresh
next i
loop
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 01:36pm 16 Feb 2019
Copy link to clipboard 
Print this post

Thanks Peter
Would you mind if I ask what the -mm and +mm means?
I'm trying to see if I can get scrolling text on a certain position of the screen
maybe in a box if thats possible
I'd like to put a simple weather description and a few other things scrolling underneath the date on the clock
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3470
Posted: 02:04pm 16 Feb 2019
Copy link to clipboard 
Print this post

mm.fontwidth is the width (in pixels) of a character in the font. The code is moving the position of the displayed text one pixel at a time to the left.

"+" and "-" are the normal addition and subtraction operators.
Edited by lizby 2019-02-18
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 06:33pm 16 Feb 2019
Copy link to clipboard 
Print this post

Thanks
I guess there's no way to keep both the clock ticking and the text scrolling at the same time>?
I've tried every combination I can think of that might work
I've got the clock working perfectly, and the scrolling perfectly but cannot get both working together
2019-02-17_043314_picture.zip
[code] '***Thanks to Matherp for his excellent clock code***
option explicit
option default none
dim integer buff(480*460*3/8-1)
dim integer nt=4 'Number of triangles being updated
dim integer xx0(nt-1),yy0(nt-1),xx1(nt-1),yy1(nt-1),xx2(nt-1),yy2(nt-1),tcol(nt-1),secs,mins,hours,first=1
dim integer oldsecs,i
dim a$
cls RGB(black)
load image "3.bmp",0,0
circle 240,240,238,2,1,RGB(RED)
blit read #1,0,0,480,480
FONT 4
option autorefresh off
a$="Hello world, this is a test of right to left scrolling. "
do
secs=val(right$(time$,2))
mins=val(mid$(time$,4,2))
hours=val(left$(time$,2)) mod 12
if secs <> oldsecs then
hands(secs,mins,hours,(MM.HRES\2-MM.HRES\12),MM.Hres\2, MM.HRES\2)
for i=0 to -mm.fontwidth*len(a$) step -2
text i,650,a$
text i+mm.fontwidth*len(a$),650,a$
refresh
next i
Text 100,540, day$(now) , LB, 4, 2, RGB(white),RGB(black) 'Day
Text 70,600, date$ , LB, 4, 2, RGB(white),RGB(black)
end if
oldsecs = secs
loop

end

Sub hands(seconds As integer, minutes as integer, hours as integer, size as integer, x as integer, y as integer)
Local integer x1,y1,x2,y2,x0,y0,i
local float angle=seconds*6
rotatetriangle(2,RGB(RED),angle,x,y,-3,50,3,50,-3,-size) 'make up the second hand with two triangles
rotatetriangle(3,RGB(RED),angle,x,y,3,-size,3,50,-3,-size)
angle=minutes*6 + seconds/10
rotatetriangle(0,RGB(green),angle,x,y,-size/20,0,size/20,0,0,-size*0.9)
angle=hours*30 + minutes/2
rotatetriangle(1,RGB(green),angle,x,y,-size/20,0,size/20,0,0,-size*0.75)
blit write #1,0,0
triangle xx0(), yy0(), xx1(), yy1(), xx2(), yy2()) ,tcol() ,tcol()
Circle x,y, size\16, 0, , rgb(red), rgb(red))
Circle x,y, size\20, 0, , 0, 0
Circle x,y, size\24, 0, , RGB(gray), RGB(gray)
refresh
End Sub

sub rotatetriangle(n as integer, col as integer, angle as float, x as integer, y as integer, x0 as integer, y0 as integer, x1 as integer, y1 as integer, x2 as integer, y2 as integer)
local float sine=sin(rad(angle)),cosine=cos(rad(angle))
local integer x0a,y0a,x1a,y1a,x2a,y2a
x0a= x0*cosine - y0 * sine + x
y0a= y0*cosine + x0 * sine + y
x1a= x1*cosine - y1 * sine + x
y1a= y1*cosine + x1 * sine + y
x2a= x2*cosine - y2 * sine + x
y2a= y2*cosine + x2 * sine + y
xx0(n)=x0a
yy0(n)=y0a
xx1(n)=x1a
yy1(n)=y1a
xx2(n)=x2a
yy2(n)=y2a
tcol(n)=col
end sub
[/code]
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3470
Posted: 08:30pm 16 Feb 2019
Copy link to clipboard 
Print this post

For a one-second per pixel shift, try this (if I've understood):
[code]
i = 0
do
secs=val(right$(time$,2))
mins=val(mid$(time$,4,2))
hours=val(left$(time$,2)) mod 12
if secs <> oldsecs then
hands(secs,mins,hours,(MM.HRES\2-MM.HRES\12),MM.Hres\2, MM.HRES\2)
text i,650,a$
text i+mm.fontwidth*len(a$),650,a$
refresh
i = i - 2
if i < -mm.fontwidth*len(a$) then : i = 0 : endif
Text 100,540, day$(now) , LB, 4, 2, RGB(white),RGB(black) 'Day
Text 70,600, date$ , LB, 4, 2, RGB(white),RGB(black)
end if
oldsecs = secs
loop
[/code]

PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:02pm 16 Feb 2019
Copy link to clipboard 
Print this post

  lizby said   For a one-second per pixel shift, try this (if I've understood):

Thank you, it was going a bit slow so I changed it slightly and now it works great apart from a pause for a moment as the second hand moves.
I really with the MM could do 2 things at the same time then the second hand could move while the text was still scrolling instead of pausing to move the tick

You can see what I mean here - YouTube Link

[code]FONT 4
a$="Hello world, this is a test of right to left scrolling. "
i = 0
do
secs=val(right$(time$,2))
mins=val(mid$(time$,4,2))
hours=val(left$(time$,2)) mod 12
text i,650,a$
text i+mm.fontwidth*len(a$),650,a$
refresh
i = i - 2
if i < -mm.fontwidth*len(a$) then : i = 0 : endif
if secs <> oldsecs then
hands(secs,mins,hours,(MM.HRES\2-MM.HRES\12),MM.Hres\2, MM.HRES\2)
Text 100,540, day$(now) , LB, 4, 2, RGB(white),RGB(black) 'Day
Text 70,600, date$ , LB, 4, 2, RGB(white),RGB(black)
end if
oldsecs = secs
loop[/code]

Edited by lew247 2019-02-18
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 09:25am 06 Mar 2019
Copy link to clipboard 
Print this post

Peter if you spot this post
is there a way to limit the width of the scroll?
I've figured out where to start the scroll from but it always then scrolls across the full width of the screen
An example of what I'd like is on an SSD1963 scroll from 50 to 350 where the width is 800 if that makes sense
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10572
Posted: 01:41pm 06 Mar 2019
Copy link to clipboard 
Print this post

  Quote  is there a way to limit the width of the scroll?


BLIT READ the part of the screen after column 350. Write the text full width. Then BLIT WRITE the original screen contents back. Do this with AUTOREFRESH OFF and only refresh once the BLIT WRITE has completed
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 12:30pm 08 Mar 2019
Copy link to clipboard 
Print this post

I can't get this to work, I can get it so it works but it still writes to the full width of the screen

I cannot get the word drizzle to scroll inbetween the word Summary and the red line on the right
no matter what I try it always starts ok, but then scrolls the whole width

[code] '***Thanks to Matherp for his help with the hands***
cls RGB(white)
option explicit
option default none
dim integer buff(480*480*3/8-1)
dim integer nt=4 'Number of triangles being updated
dim integer xx0(nt-1),yy0(nt-1),xx1(nt-1),yy1(nt-1),xx2(nt-1),yy2(nt-1),tcol(nt-1),secs,mins,hours,first=1
dim integer oldsecs,i
DIM STRING q$=chr$(34)
dim x$,z$,Temp$,Wind$,prob$,type$,summary$
dim integer val1
Dim INTEGER a(10000)
SetTick 900000,weather,1 'every 15 minutes
load image "4.bmp",0,0
circle 240,240,238,3,1,RGB(RED)
blit read #1,0,0,480,480
blit write #2,350,710
option autorefresh off
FONT 4,2
i = 0
secs=val(right$(time$,2))
mins=val(mid$(time$,4,2))
hours=val(left$(time$,2)) mod 12
Text 100,530, day$(now) , LB, 4, 2, RGB(BLACK),RGB(WHITE) 'Day
Text 70,590, date$ , LB, 4, 2, RGB(BLACK),RGB(WHITE) 'Date
weather
do
secs=val(right$(time$,2))
mins=val(mid$(time$,4,2))
hours=val(left$(time$,2)) mod 12
if secs <> oldsecs then
hands(secs,mins,hours,(MM.HRES\2-MM.HRES\12),MM.Hres\2, MM.HRES\2)
end if mins = 0 and secs = 0
elseif mins = 15 and secs = 0
elseif mins = 30 and secs = 0
elseif mins = 45 and secs = 0 then
weather
pause 800
end if
if time$ = "00:00:00" then
Text 100,530, " ") , LB, 4, 2, RGB(BLACK),RGB(WHITE) 'Clear Day
Text 100,530, day$(now) , LB, 4, 2, RGB(BLACK),RGB(WHITE) 'Day
Text 70,590, " ", LB, 4, 2, RGB(BLACK),RGB(WHITE) 'Clear Date
Text 70,590, date$ , LB, 4, 2, RGB(BLACK),RGB(WHITE) 'Date
pause 950
end if
BOX 2, 620, 476, 175, 3, RGB(red)

text i,650,summary$
text i+mm.fontwidth*len(z$),720,summary$
refresh
i = i - 2
if i < -mm.fontwidth*len(summary$) then : i = 0 : endif
blit write #2,350,710
refresh
oldsecs = secs
loop

end


sub weather
system "wget -q -O- "+q$+"https://api.darksky.net/forecast/458113cd1162af4b1f0677d08822fbaf/53.440120,-2.106181?units=uk2&exclude=flags,aler ts,minutely"+q$,a()
pause 700
on error IGNORE
Temp$ = JSON$(a(),"currently.temperature")+"`C "
Wind$ = JSON$(a(),"currently.windspeed")+"MPH "
prob$ = JSON$(a(),"hourly.data[0].precipProbability")
type$ = JSON$(a(),"hourly.data[0].precipType")
summary$ = JSON$(a(),"currently.summary")
Text 60,660, " ",LB, 4, 1, RGB(BLACK),RGB(WHITE)
Text 60,660, "Temperature "+ Temp$ , LB, 4, 1, RGB(BLACK),RGB(WHITE)
Text 60,700, " ",LB, 4, 1, RGB(BLACK),RGB(WHITE)
Text 60,700, "Windspeed "+ Wind$, LB, 4, 1, RGB(BLACK),RGB(WHITE)
Text 60,740, " ",LB, 4, 1, RGB(BLACK),RGB(WHITE)
Text 60,740, "Summary "'+ summary$ , LB, 4, 1, RGB(BLACK),RGB(WHITE)
val1 = val(prob$)
val1 = val1 * 100
print val1, "Val1"
if val1 >= 1 then
print val1
Text 60,780, " ",LB, 4, 1, RGB(BLACK),RGB(WHITE)
Text 60,780, STR$(val1)+ "% chance of "+type$, LB, 4, 1, RGB(BLACK),RGB(WHITE)
end if
print STR$(val1), "Val"
print Wind$
end sub


Sub hands(seconds As integer, minutes as integer, hours as integer, size as integer, x as integer, y as integer)
Local integer x1,y1,x2,y2,x0,y0,i
local float angle=seconds*6
rotatetriangle(2,RGB(RED),angle,x,y,-3,50,3,50,-3,-size) 'make up the second hand with two triangles
rotatetriangle(3,RGB(RED),angle,x,y,3,-size,3,50,-3,-size)
angle=minutes*6 + seconds/10
rotatetriangle(0,RGB(black),angle,x,y,-size/20,0,size/20,0,0,-size*1.04) ' Minute hand
angle=hours*30 + minutes/2
rotatetriangle(1,RGB(black),angle,x,y,-size/20,0,size/20,0,0,-size*0.78) ' Hour hand
blit write #1,0,0
triangle xx0(), yy0(), xx1(), yy1(), xx2(), yy2()) ,tcol() ,tcol()
Circle x,y, size\16, 0, , rgb(red), rgb(red))
Circle x,y, size\20, 0, , 0, 0
Circle x,y, size\24, 0, , RGB(red), RGB(red)
refresh
End Sub

sub rotatetriangle(n as integer, col as integer, angle as float, x as integer, y as integer, x0 as integer, y0 as integer, x1 as integer, y1 as integer, x2 as integer, y2 as integer)
local float sine=sin(rad(angle)),cosine=cos(rad(angle))
local integer x0a,y0a,x1a,y1a,x2a,y2a
x0a= x0*cosine - y0 * sine + x
y0a= y0*cosine + x0 * sine + y
x1a= x1*cosine - y1 * sine + x
y1a= y1*cosine + x1 * sine + y
x2a= x2*cosine - y2 * sine + x
y2a= y2*cosine + x2 * sine + y
xx0(n)=x0a
yy0(n)=y0a
xx1(n)=x1a
yy1(n)=y1a
xx2(n)=x2a
yy2(n)=y2a
tcol(n)=col
end sub[/code]
 
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025