Home  |  Contents 

Microcontroller and PC projects
  Forum Index : Microcontroller and PC projects         Section
Subject Topic: HC-12 Post ReplyPost New Topic
<< Prev Page of 3 Next >>
Author
Message << Prev Topic | Next Topic >>
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6068
Posted: 04 July 2018 at 7:38pm | IP Logged Quote Grogster

That's interesting. Taking the GUI controls out of the mix for now, the interpreter is trying to If 22.6 < 0 Then, which to me, is perfectly legal.

IE: The result should be false, because 22.6 is NOT less then zero. Watching this thread with interest.

__________________
Smoke makes things work. When the smoke gets out, it stops!


Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
erbp
Regular Member
Regular Member


Joined: 03 May 2016
Location: Australia
Online Status: Offline
Posts: 65
Posted: 04 July 2018 at 9:22pm | IP Logged Quote erbp

Unfortunately printing the contents of these items doesn't identify the item data type (unless the contents happen to contain alpha or special characters in which case it would have to be String).

In the above case CTRLVAL(tempa) could be a String or a Float while CTRLVAL(lowtemp) could be String, Float or Integer.

I **think** the error is because there is a mismatch of data types between the two items being compared.

Phil.
Back to Top View erbp's Profile Search for other posts by erbp
 
Andrew_G
Senior Member
Senior Member


Joined: 18 October 2016
Location: Australia
Online Status: Offline
Posts: 241
Posted: 05 July 2018 at 11:33am | IP Logged Quote Andrew_G

Hi Phil, we haven't seen the code for the derivation of "tempa" and "lowtemp" but let's assume it is OK.
How about you run the program but <CTL><C> when it should have values for each "tempa" and "lowtemp" (you could confirm by printing each as you have above).

Then from the console enter "? VAL(tempa)" then "? VAL(lowtemp)"
Then "? STR$(tempa)" then "? STR$(lowtemp)"

This should show if they are string when we think they are not and vice versa.

Another possibility is that a bug means it is treating "0" not as "0" ??
Cheers,

Andrew
Back to Top View Andrew_G's Profile Search for other posts by Andrew_G
 
Andrew_G
Senior Member
Senior Member


Joined: 18 October 2016
Location: Australia
Online Status: Offline
Posts: 241
Posted: 05 July 2018 at 10:25pm | IP Logged Quote Andrew_G

John, if you refer to Geoff's post about the latest Beta release he may have fixed a relevant bug??

Cheers, Andrew
Back to Top View Andrew_G's Profile Search for other posts by Andrew_G
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 06 July 2018 at 4:41pm | IP Logged Quote macca

Hi Andrew_G and all involved especially Geoff
Loaded latest release and all is working fine

Regards
John
Back to Top View macca's Profile Search for other posts by macca
 
Andrew_G
Senior Member
Senior Member


Joined: 18 October 2016
Location: Australia
Online Status: Offline
Posts: 241
Posted: 06 July 2018 at 5:13pm | IP Logged Quote Andrew_G

Hi John, glad it is all sorted. In case you hadn't noticed, Geoff (and a few others) is a marvel!

Andrew
Back to Top View Andrew_G's Profile Search for other posts by Andrew_G
 
Grogster
Guru
Guru
Avatar

Joined: 31 December 2012
Location: New Zealand
Online Status: Offline
Posts: 6068
Posted: 06 July 2018 at 5:26pm | IP Logged Quote Grogster

Wow. Awesome. So what version WERE you using? I assume you are now on 5.04.09?

__________________
Smoke makes things work. When the smoke gets out, it stops!
Back to Top View Grogster's Profile Search for other posts by Grogster Visit Grogster's Homepage
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 08 July 2018 at 6:29pm | IP Logged Quote macca

Hi and yes Grogster 5.04.09 and a very big tank's to Geoff and all involved. This is the best forum by far that I have had any thing to do with.
You guy's are awesome
Regards
John
Back to Top View macca's Profile Search for other posts by macca
 
CaptainBoing
Guru
Guru
Avatar

Joined: 07 September 2016
Location: United Kingdom
Online Status: Offline
Posts: 572
Posted: 08 July 2018 at 8:16pm | IP Logged Quote CaptainBoing

macca wrote:
This is the best forum by far that I have had any thing to do with.
You guy's are awesome



+1 true dat
Back to Top View CaptainBoing's Profile Search for other posts by CaptainBoing
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 12 July 2018 at 11:25pm | IP Logged Quote macca

Hi to all again
Still have problems but this time with DHT12 can not get the led to come on when temp is higher than numberbox. eg code below

'E100 board
'Firmware V5.04.09



cls
Const frm_alarm = 1, nbr_hi = 2, nbr_lo = 3
Const c_hi = 4, c_lo = 5, tempa = 6, huma = 7, led_alarm = 8
const hi_alarm = 9
DIM float Temp, hum
humid 28, Temp, Hum



Font 3 : GUI Frame frm_alarm, "Alarm", 380, 150, 200, 130,RGB(green)
GUI Caption c_hi, "High:", 390, 170, "LT", RGB(yellow)
GUI Numberbox nbr_hi, 470,MM.VPos-6,90,MM.FontHeight+12,RGB(yellow),RGB(64,64,64)
GUI Caption c_lo, "Low:", 390, 220, LT, RGB(yellow),0
GUI Numberbox nbr_lo, 470,MM.VPos-6,90,MM.FontHeight+12,RGB(yellow),RGB(64,64,64)
font 2
GUI Displaybox tempa,125,122,55,40,RGB(green),RGB(red)
GUI Displaybox huma,125,170,55,40,RGB(green),RGB(red)
GUI LED led_alarm, "Alarm", 250, 300, 45, rgb(red)
GUI Caption hi_alarm, "High:", 30, 130, "LT", RGB(yellow)
CtrlVal(led_alarm) = 0

do

pause 2000
if CtrlVal(tempa) > nbr_hi then 'problem is here I think ??
CtrlVal(led_alarm) = 1 'led stays on regardles if tempa or nbr_hi is low or high ??
CtrlVal(tempa) = str$(Temp)'temp from DHT12
CtrlVal(huma) = str$(Hum) 'Humidity from DHT12
endif
loop






CSub HUMID integer, float, float
0000002B 27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008
27BD0008 27BDFFE0 AFBF001C 00002021 3C059D00 24A50040 27A60010 0411FFF1
00000000 8FA30010 3C029D00 8C4200BC 3C049D00 24840414 0040F809 00832021
8FBF001C 03E00008 27BD0020 00041080 000419C0 00621823 00642021 000418C0
3C029D00 8C420000 3C047735 34849400 8C420000 0082001B 004001F4 00002012
0064001B 008001F4 03E00008 00001012
27BDFFB8 AFBF0044 AFBE0040 AFB7003C AFB60038 AFB50034 AFB40030 AFB3002C
AFB20028 AFB10024 AFB00020 00808821 00A0A821 3C029D00 8C420000 8C430000
3C020098 34429680 0062102B 10400003 00C0B021 0411FFC7 00000000 3C109D00
8E02001C 8E240000 0040F809 24050006 8E020010 8E240000 24050009 0040F809
00003021 8E02001C 8E240000 0040F809 2405000E 8E02001C 8E240000 0040F809
24050005 8E020004 0040F809 240403E8 8E02001C 8E240000 0040F809 24050006
8E020080 240403E8 0040F809 00002821 AEC20000 AEA20000 0411FFB8 24040190
00409821 0000A021 40944800 00008021 10000005 3C129D00 40104800 0270102B
1440008E 8FBF0044 8E420020 0040F809 8E240000 1440FFF8 00000000 10000007
3C129D00 40104800 0270102B 50400004 8E420020 10000081 8FBF0044 8E420020
0040F809 8E240000 1040FFF6 00000000 10000007 3C129D00 40104800 0270102B
50400004 8E420020 10000074 8FBF0044 8E420020 0040F809 8E240000 1440FFF6
00001021 00001821 AFA20010 AFA30014 0000B821 10000005 3C129D00 40104800
0270102B 14400065 8FBF0044 8E420020 0040F809 8E240000 1040FFF8 00000000
40944800 10000006 8E420020 40104800 0270102B 14400059 8FBF0044 8E420020
0040F809 8E240000 1440FFF8 8FA30010 000317C2 8FA50014 0005F040 005EF025
00031040 AFA20018 0411FF6C 24040032 0050102B 8FA30018 00431025 AFA20010
26F70001 24050028 16E5FFE0 AFBE0014 001E1600 8FA50010 00052202 00442025
001E1200 00058E02 00518825 7CA33C00 308200FF 00621821 322200FF 00621821
93A50014 30A200FF 00621021 8FA30010 00431026 304200FF 1440002F 001EA603
3C109D00 8E130064 8E020080 30847FFF 0040F809 00002821 00409021 8E020080
2404000A 0040F809 00002821 02402021 0260F809 00402821 00408021 AEA20000
3C020080 8FA50010 00451024 5040000C 3C109D00 3C029D00 8C520058 8C420080
2404FFFF 0040F809 2405FFFF 02002021 0240F809 00402821 AEA20000 3C109D00
8E120064 8E020080 02202021 0040F809 02802821 00408821 8E020080 2404000A
0040F809 00002821 02202021 0240F809 00402821 AEC20000 8FBF0044 8FBE0040
8FB7003C 8FB60038 8FB50034 8FB40030 8FB3002C 8FB20028 8FB10024 8FB00020
03E00008 27BD0048 20555043 65657073 6F742064 6F6C206F 000A0D77
End CSub
' End program.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
I am doing something wrong but cannot put my finger on it

Regards
John
Back to Top View macca's Profile Search for other posts by macca
 
Geoffg
Guru
Guru
Avatar

Joined: 06 June 2011
Location: Australia
Online Status: Offline
Posts: 2392
Posted: 13 July 2018 at 12:05am | IP Logged Quote Geoffg

I might be reading your program incorrectly but in your do loop you only ever set CtrlVal(led_alarm) high (never low). This is why it stays on.
Back to Top View Geoffg's Profile Search for other posts by Geoffg Visit Geoffg's Homepage
 
macca
Newbie
Newbie


Joined: 21 February 2017
Location: Australia
Online Status: Offline
Posts: 32
Posted: 13 July 2018 at 7:53pm | IP Logged Quote macca

Hi Geoffg
Below is program with errors, I cannot get this working

'E100 board
'Firmware V5.04.09



cls
Const frm_alarm = 1, nbr_hi = 2, nbr_lo = 3
Const c_hi = 4, c_lo = 5, tempa = 6, huma = 7, led_alarm = 8
const hi_alarm = 9
DIM float Temp, hum
'humid 28, Temp, Hum


Font 3 : GUI Frame frm_alarm, "Alarm", 380, 150, 200, 130,RGB(green)
GUI Caption c_hi, "High:", 390, 170, "LT", RGB(yellow)
GUI Numberbox nbr_hi, 470,MM.VPos-6,90,MM.FontHeight+12,RGB(yellow),RGB(64,64,64)
font 2
GUI Displaybox tempa,125,122,55,40,RGB(green),RGB(red)
GUI Displaybox huma,125,170,55,40,RGB(green),RGB(red)
GUI LED led_alarm, "Alarm", 250, 300, 45, rgb(red)
GUI Caption hi_alarm, "High:", 30, 130, "LT", RGB(yellow)
CtrlVal(led_alarm) = 0
A = 0
Temp = 28
do
CtrlVal(tempa) = str$(Temp)'temp from DHT12
'CtrlVal(huma) = str$(Hum) 'Humidity from DHT12

text 10, 10, str$(Temp)
print CtrlVal(nbr_hi) ' this prints 0 as it should
text 100, 10, str$(nbr_hi) ' this prints 2 ??????????
'text 130, 10,CtrlVal(nbr_hi) 'Error: Expected a string
'text 130, 10,CtrlVal(str$(nbr_hi)) 'Error: Expected a number
if str$(Temp) > CtrlVal(nbr_hi) then 'Error: Incompatible types in expression
'> ?VAL Temp: ?VAL nbr_hi
' 0 28
'0 2

CtrlVal(led_alarm) = 1






elseif str$(Temp) < str$(nbr_hi) then
pause 3000
CtrlVal(led_alarm) = 0
else
endif
pause 1000
A = A + 1' Counting loops
text 10, 310, str$(A)
loop






CSub HUMID integer, float, float
0000002B 27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008
27BD0008 27BDFFE0 AFBF001C 00002021 3C059D00 24A50040 27A60010 0411FFF1
00000000 8FA30010 3C029D00 8C4200BC 3C049D00 24840414 0040F809 00832021
8FBF001C 03E00008 27BD0020 00041080 000419C0 00621823 00642021 000418C0
3C029D00 8C420000 3C047735 34849400 8C420000 0082001B 004001F4 00002012
0064001B 008001F4 03E00008 00001012
27BDFFB8 AFBF0044 AFBE0040 AFB7003C AFB60038 AFB50034 AFB40030 AFB3002C
AFB20028 AFB10024 AFB00020 00808821 00A0A821 3C029D00 8C420000 8C430000
3C020098 34429680 0062102B 10400003 00C0B021 0411FFC7 00000000 3C109D00
8E02001C 8E240000 0040F809 24050006 8E020010 8E240000 24050009 0040F809
00003021 8E02001C 8E240000 0040F809 2405000E 8E02001C 8E240000 0040F809
24050005 8E020004 0040F809 240403E8 8E02001C 8E240000 0040F809 24050006
8E020080 240403E8 0040F809 00002821 AEC20000 AEA20000 0411FFB8 24040190
00409821 0000A021 40944800 00008021 10000005 3C129D00 40104800 0270102B
1440008E 8FBF0044 8E420020 0040F809 8E240000 1440FFF8 00000000 10000007
3C129D00 40104800 0270102B 50400004 8E420020 10000081 8FBF0044 8E420020
0040F809 8E240000 1040FFF6 00000000 10000007 3C129D00 40104800 0270102B
50400004 8E420020 10000074 8FBF0044 8E420020 0040F809 8E240000 1440FFF6
00001021 00001821 AFA20010 AFA30014 0000B821 10000005 3C129D00 40104800
0270102B 14400065 8FBF0044 8E420020 0040F809 8E240000 1040FFF8 00000000
40944800 10000006 8E420020 40104800 0270102B 14400059 8FBF0044 8E420020
0040F809 8E240000 1440FFF8 8FA30010 000317C2 8FA50014 0005F040 005EF025
00031040 AFA20018 0411FF6C 24040032 0050102B 8FA30018 00431025 AFA20010
26F70001 24050028 16E5FFE0 AFBE0014 001E1600 8FA50010 00052202 00442025
001E1200 00058E02 00518825 7CA33C00 308200FF 00621821 322200FF 00621821
93A50014 30A200FF 00621021 8FA30010 00431026 304200FF 1440002F 001EA603
3C109D00 8E130064 8E020080 30847FFF 0040F809 00002821 00409021 8E020080
2404000A 0040F809 00002821 02402021 0260F809 00402821 00408021 AEA20000
3C020080 8FA50010 00451024 5040000C 3C109D00 3C029D00 8C520058 8C420080
2404FFFF 0040F809 2405FFFF 02002021 0240F809 00402821 AEA20000 3C109D00
8E120064 8E020080 02202021 0040F809 02802821 00408821 8E020080 2404000A
0040F809 00002821 02202021 0240F809 00402821 AEC20000 8FBF0044 8FBE0040
8FB7003C 8FB60038 8FB50034 8FB40030 8FB3002C 8FB20028 8FB10024 8FB00020
03E00008 27BD0048 20555043 65657073 6F742064 6F6C206F 000A0D77
End CSub
' End program.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sorry to be a pain in the bum
I have tried different ways and the same problem pops up
Probably I have missed something

Best regards
John


Back to Top View macca's Profile Search for other posts by macca
 


<< Prev Page of 3 Next >>
In the news...
 
Post ReplyPost New Topic
Printable version Printable version
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Powered by Web Wiz Forums version 7.8
Copyright ©2001-2004 Web Wiz Guide

This page was generated in 0.1094 seconds.
Privacy Policy     Process times : 0, 0, 0, 0.11