Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:55 09 Jul 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 : Newie got a few questions

     Page 7 of 25    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10224
Posted: 03:54am 01 Sep 2016
Copy link to clipboard 
Print this post

Have a look at Geoff's example code page 36 of the Micromite Plus addendum.
Load this and run it and then make some changes to see how it all fits together
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 04:05am 01 Sep 2016
Copy link to clipboard 
Print this post

Thanks, got that working fine, now to figure out why the other wasn't
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:56am 01 Sep 2016
Copy link to clipboard 
Print this post

ok - now this is going to get interesting

As you all know from now, apart from me being a right pain in the rear end asking so many questions and asking for help

I've figured out the switch routines, my problem was I was reading the 5.2 manual and not the 5.2 addend

Can anyone give me any pointers on doing this section please?

Specifically the restore and disable sections
Am I right in assuming the GUI Restore is what's normally on the screen BEFORE the switch is pressed?
and
the GUI Disable is what's on the screen AFTER the switch is pressed?
Obviously I have to tell the program what to display on each setting, buT i need to know if I'm on the right path to working it out, or if I'm thinking wronglt.

[code]Sub TouchDown
Select Case Touch(REF) ' find out the control touched
Case sw1 ' the Weather/Forecast switch
If CtrlVal(sw1) = 1 Then

GUI Restore 'CLS then do the Colour RGB(white), RGB(black), and GUI forecast Sections from above - *** as a sub?? ***

Else

GUI Disable ' DO THE MAIN CLOCK/timing/serialport/picture routines here *not sure how to do this


EndIf
End Select
End Sub[/code]
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:15pm 01 Sep 2016
Copy link to clipboard 
Print this post

Why doesn't this work? and is there a way to get it working?

GUI SETUP 1
LOAD IMAGE sky1.bmp , 392 , 185
[quote]Load IMAGE sky1.bmp , 392 , 185
Error: Expected a string[/quote]

If I try pic = Sky1.bmp and LOAD IMAGE PIC$ the error is Error: PIC already declared
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:24pm 01 Sep 2016
Copy link to clipboard 
Print this post

Option Explicit not set?

[Code]new
> pic=sky.bmp
> print pic
0
> Print pic$
Error: PIC already declared
>

[/code]
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:27pm 01 Sep 2016
Copy link to clipboard 
Print this post

[Code]> new
> option explicit
> Dim Pic as String
> pic=sky.bmp
Error: SKY.BMP not declared
> pic="sky.bmp"
> print pic
sky.bmp
>
[/code]

 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:33pm 01 Sep 2016
Copy link to clipboard 
Print this post

Thanks Phil
I actually tried it without the OPTION EXPLICIT as errors in dim statements "should" have been ignored

Just tried it WITH OPTION EXPLICIT and It just wont work.
I "THINK" it's because I want to use it as part of GUI SETUP
and I think that only certain functions like touch switches and so on work with that
but there must be a way to load a picture as part of GUI SETUP 1 or GUI SETUP 2?

 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 10:36pm 01 Sep 2016
Copy link to clipboard 
Print this post

How big is the BMP?

Can it be posted?

800x480 Screen?
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 10:44pm 01 Sep 2016
Copy link to clipboard 
Print this post

PIC$="Sky1.bmp"
LOAD IMAGE PIC$

However, as I said yesterday, this will not 'keep' the image on Page 1 only as LOAD IMAGE is not an advanced GUI control (and PAGExx 'looks after' GUI controls only)

Edited by WhiteWizzard 2016-09-03
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 10:58pm 01 Sep 2016
Copy link to clipboard 
Print this post

The image is 800 X 480 and yes it could be posted
Thats a shame Phil, WHat I'd like to do with the gui controls is switch between 2 images, that way I can keep the clock on the screen all the time

I'm going to have to figure a different way to do this somehow

Here's the 2 images



and when the button is pressed to go to the 2nd screen it's just this
The clock is the same size and would go in the same place as the clock on the other picture



Edited by lew247 2016-09-03
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 11:04pm 01 Sep 2016
Copy link to clipboard 
Print this post

Peter did a recent post about Page switching allowing the images to be drawn onto each page, and then a quick switch between pages.

From memory this was a C Function/Sub and I am not sure how 'integrated' it is with MMBasic OR whether it is a pure C Function.

Either way it is worth looking at his code.

WW
 
Phil23
Guru

Joined: 27/03/2016
Location: Australia
Posts: 1667
Posted: 12:29am 02 Sep 2016
Copy link to clipboard 
Print this post

Might be able to mix the Basic & Advanced graphics.

But then again, you could just switch by an touch to a defined region of the screen;

No Advanced graphics required.

Phil.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 12:42am 02 Sep 2016
Copy link to clipboard 
Print this post

LOAD IMAGE requires the 'picture' to be drawn each time you switch to the screen where you want to see the 'picture'. As Load Image is a non-advanced GUI control, it is not automatically switched on and off when switching PAGEs.

Peter's code (from memory) allowed images to be loaded first onto 'separate' pages, and then page switching to give the appearance of quick drawing.

II will have a look to see if I can find his post . . .


 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 12:46am 02 Sep 2016
Copy link to clipboard 
Print this post

Here is the link - it was for a 44-pinner and 4.3" TFT.
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 02:26am 04 Sep 2016
Copy link to clipboard 
Print this post

I need a "little" help

I'm decoding weather data from the serial port, and trying to display the icon relating to todays weather

I've done this

I've declared both ICON and ICON1 AS STRING

I've also tried DIM ICON AS FLOAT and the same with icon1 and it does't make any difference

If icon = "01d" Then icon1 = "01d.ppm"
Error: Incompatible types in expression

This is the first part of the sub where the part of the program is located

icon = VAL(FieldArray$(2))
IF icon = "01d" THEN icon1 = "01d.ppm"
ELSE
IF icon = "01n" THEN icon1 = "01n.ppm"

Anyone know what I'm doing wrong, and more importantly - how to correct the error?


Edited by lew247 2016-09-05
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 1000
Posted: 03:00am 04 Sep 2016
Copy link to clipboard 
Print this post

icon = VAL(FieldArray$(2)) 'VAL() sets icon as a number.\\


IF icon = "01d" THEN icon1 = "01d.ppm" // This is expecting icon to be a string.


Try the first line as

icon = FieldArray$(2)

Regards
Gerry
Latest F4 Latest H7 FotS
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2932
Posted: 04:06am 04 Sep 2016
Copy link to clipboard 
Print this post

Lewis,

Try keeping things as simple as possible and use a $ at the end of a variable name that contains a string. Anything in quotes (speech marks) is a string. A number is not a string and hence: icon = "01d" is incorrect and will result in: Error: Incompatible types in expression (as left side is expecting a number, and right side is a string.

icon$ = "01d" is correct as both sides of the 'equation' are strings.

icon = val("01d") is also correct as both sides are 'numbers'

Edited by WhiteWizzard 2016-09-05
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 04:10am 04 Sep 2016
Copy link to clipboard 
Print this post

Thanks both
Phil - If i do that then I get the error
If icon$ = "01d" Then icon1$ = "01d.ppm"
Error: ICON already declared


IF I try icon = FieldArray$(2) then the error is
icon = FieldArray$(2)Edited by lew247 2016-09-05
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:07am 04 Sep 2016
Copy link to clipboard 
Print this post

Whoops
Typo The error if I try icon = FieldArray$(2)
Error: Expected a number

EDIT:
I sorted it by going at it a different way

However now I have the same problem

Error: ICON already declaredEdited by lew247 2016-09-05
 
lew247

Guru

Joined: 23/12/2015
Location: United Kingdom
Posts: 1702
Posted: 05:23am 04 Sep 2016
Copy link to clipboard 
Print this post

@Matherp

A problem you "hopefully" will know the answer to Peter

[code]SUB T1

IF FieldArray$(2) = "01d" THEN FieldArray$(2) = "01d.ppm"
ELSE
IF FieldArray$(2) = "01n" THEN FieldArray$(2) = "01n.ppm"
ELSE
IF FieldArray$(2) = "02d" THEN FieldArray$(2) = "02d.ppm"
ELSE
IF FieldArray$(2) = "02n" THEN FieldArray$(2) = "02n.ppm"
ELSE
IF FieldArray$(2) = "03d" THEN FieldArray$(2) = "03d.ppm"
ELSE
IF FieldArray$(2) = "03n" THEN FieldArray$(2) = "03n.ppm"
ELSE
IF FieldArray$(2) = "04d" THEN FieldArray$(2) = "04d.ppm"
ELSE
IF FieldArray$(2) = "04n" THEN FieldArray$(2) = "04n.ppm"
ELSE
IF FieldArray$(2) = "09d" THEN FieldArray$(2) = "09d.ppm"
ELSE
IF FieldArray$(2) = "09n" THEN FieldArray$(2) = "09n.ppm"
ELSE
IF FieldArray$(2) = "10d" THEN FieldArray$(2) = "10d.ppm"
ELSE
IF FieldArray$(2) = "10n" THEN FieldArray$(2) = "10n.ppm"
ELSE
IF FieldArray$(2) = "11d" THEN FieldArray$(2) = "11d.ppm"
ELSE
IF FieldArray$(2) = "11n" THEN FieldArray$(2) = "11n.ppm"
ELSE
IF FieldArray$(2) = "13d" THEN FieldArray$(2) = "13d.ppm"
ELSE
IF FieldArray$(2) = "13d" THEN FieldArray$(2) = "13n.ppm"
ELSE
IF FieldArray$(2) = "13d" THEN FieldArray$(2) = "50d.ppm"
ELSE
IF FieldArray$(2) = "50d" THEN FieldArray$(2) = "50n.ppm"
END IF
PRINT FieldArray$(2)
DisplayPicture FieldArray$(2) , 392 , 185
END SUB[/code]

Error =
[196] SDcard fileopen,PIC$
Error: No File

Any idea what this might mean Peter? The program will quite happily display .ppm pictures if I call them directly, and all the .ppm pictures are on the SD card and I just checked them all and they all open normally just not when called by this routine

EDIT:
I'm using your code for loading .ppm pictures from Here Edited by lew247 2016-09-05
 
     Page 7 of 25    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025