![]() |
Forum Index : Microcontroller and PC projects : Humid Command
Author | Message | ||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
Trying to teach my Grandson about the mites and I feel like a real goose. We have a DHT22 connected with the following code ' Temperatue and Humidity Dim as float temp, humidity humid 18, temp, humidity print temp, humidity 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 When run I get this error Sometimes I get What is wrong. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
The PIN has to be an INTEGER. I use: If you have DEFAULT INTEGER set, your code 'should' work as is but I prefer to set each one as required. Jim VK7JH MMedit |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
Thank Jim, a while since I have used this. I was showing my Grandson from the manual and it is not mentioned there. Paul. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
OK did that but now getting error I think I will re flash the chip and start again. It can't be this hard, and just when I'm showing my Grandson how smart I am. Edit...I now see the "DIM AS INTEGER DHT22pin = 26" is mentioned in the CSUB "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
palcal![]() Guru ![]() Joined: 12/10/2011 Location: AustraliaPosts: 1993 |
Got to the bottom of the problem, something stupid as usual. I am using an E-28 I bought from Grogster but the version of the firmware it was using did not support the HUMID C sub. Upgraded to a later version and all is OK. Got that wrong as well, not Grogster's fault, I showed my Grandson how to flash the chip and I used the wrong version. "It is better to be ignorant and ask a stupid question than to be plain Stupid and not ask at all" |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Glad that it was fixed. Just a point of clarification. The CSub starts with: CSub HUMID integer, float, float 0000002B 27BDFFF8 AFBF0004 00852023 03E42021 ACC40000 8FBF0004 03E00008 27BD0008 27BDFFE0 AFBF001C 00002021 3C059D00 24A50040 27A60010 0411FFF1 ... The first argument is declared as an INTEGER. This means that MMBasic will convert a float (if supplied) to an integer - so you don't have to worry what type of argument it is (float or integer) MMBasic knows that an integer is required and will make it so. This does not apply to the next two arguments. Because the CSub needs to pass back the results to a float these variables must to be declared as floats. Geoff Graham - http://geoffg.net |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |