Students (and teacher!) need help with humidity sensor program (Tracy Allen, he
Hi All,
·· I'm new to the forum and Parallax. My students and I are trying to figure out how to get the USB DataLogger to·log and store·data from the Sensirion temperature/humidity sensor to teh flash drive.·Unfortunately, I have virtually no programming experience.
Could someone please post (or e-mail) us a program·to synchronize the humidity sensor and the DataLogger? We're using a BS2 stamp and a 'Board of Education." We appreciate your help! Thanks and,
Regards,
Mark Kibler - Weare Middle School,NH
mkibler@unity.edu
·· I'm new to the forum and Parallax. My students and I are trying to figure out how to get the USB DataLogger to·log and store·data from the Sensirion temperature/humidity sensor to teh flash drive.·Unfortunately, I have virtually no programming experience.
Could someone please post (or e-mail) us a program·to synchronize the humidity sensor and the DataLogger? We're using a BS2 stamp and a 'Board of Education." We appreciate your help! Thanks and,
Regards,
Mark Kibler - Weare Middle School,NH
mkibler@unity.edu
Comments
·· Thanks for your reply. We've run the demo programs for both the humidity sensor and the DataLogger, and they run just fine. You said, "You will have to decide how you want the Sensirion data to look in the file you're creating." I'm not sure what this means really. I have virtually no programming experience.
For what it's worth, I'm working with some 8th and 9th grade students·who have a robot inside a rocket they designed. They are launching it at NASA's Marshall Space Flight·Center·to an altitude of 1 mile (www.wearerocketry.org)! Their robot is supposed to measure and record·temperature and humidity on the way up. Then the robot parachutes down, collecting humidity and temperature readings as it descends. When it lands it maneuvers across the terrain, collecting data as it goes
I'm stumped by program language, Mike. I know it's 'simply' a matter of combining the·sensor and the DataLogger·programs (I think.) But I don't know how, and so I can't explain it to the students... simply, or at all. Can you post a program for us to try? Thanks again for your reply (that rhymes!)
Mark
Other questions to be answered:
1) How often do you want a measurement?
2) Are you going to use the heater to compensate for ambient temperature?
3) How often and how long?
4) How long do you want to make measurements?
5) How do you plan to start the program?
6) How do you plan to signal to the program that the flight is over? The Stamp has to tell the Datalogger to close the file.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
1) How often do you want a measurement? - We'd like data capture every second or so, minimum
2) Are you going to use the heater to compensate for ambient temperature? - Yes, we would like to keep the heater on to compensate.
3) How often and how long? - We should allow about 15 minutes for data capture. Their rocket may set on the launch pad for several minutes. The flight is about 4 minutes, top to bottom. The robot will traverse the ground, collecting data until we retrieve it.
4) How long do you want to make measurements? - See #3 above
5) How do you plan to start the program? - That's a good question! We may just start push the 'on' button (simple,I know) when we put it in the rocket's payload bay. We've considered adding an accelerometer to the board to activate the program. But that just complicates things.
6) How do you plan to signal to the program that the flight is over? The Stamp has to tell the Datalogger to close the file. - Again, the robot will collect data until we retrieve it after touchdown.
I downloaded PBASIC 2.4 - is that PBASIC 2.5? Thanks so much for your help!
Mark
http://forums.parallax.com/showthread.php?p=704340
Attached is an attempt to merge the two sample programs. I have neither a Sensirion sensor nor a Memory Stick Datalogger to test it, but others may have them. Perhaps others will chime in. This version can at least form the basis of further discussions. You will need to learn more about Stamps and Stamp programming than you think. You will need to understand the sample programs somewhat, at least in general terms, and learn enough to be able to modify them a little, particularly for debugging. You should take some time to read and work through some of the examples in the What's a Microcontroller? tutorial.
I was out of touch over the weekend, but since you addressed the question to me, I think I'd better chime in! I don't have anything immediate to add. Mike has given you good advice and also an example to work with.
I feel your frustration about not having the programming background to guide your students. The ideal solution would be to lay it on them. There must (?!) be one or two 8th or 9th graders, given the great opportunity they have with this rocket depoyment at Marshall (wow!) who can step up the challenge and figure it out. They might surprise you! It would also be a great challenge for them to devise a simple switch that can start the logging at the first jolt of acceleration.
One first step might be to log the Sensirion data in the Stamp's own memory for a while. The Applied Sensors text has a data logger of that sort as its final project. It could store temperature as one byte, say 0 to 255 to represent -25 degrees Celsius to +100 degrees Celsius, and humidity as one byte for 0-100%. Will the project also have a real time clock to tick off the seconds? You might also want to store a time value or index. On the memory card, you will want to store the data as text, with fields and records delimited so that you can open it directly in a program like Excel.
I can help with the Sensirion part, but I don't have the Parallax logger.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
· Thanks for posting your "RocketRobotprogram.BS2". We tried it, but when we ran it we got an error message: "symbol already defined" for 'ioByte'. He'res the first part of the program, and I can see where the 'ioByte' command appears to be used twice (for VAR B19 and for VAR B13). I will swallow my pride and say I have absolutely no idea what this means, or how to fix the program. Can you offer any suggestions? How do you 'reassign' a function (?) like 'ioByte' when it's already being used by another part of teh program? What information can we offer you about our hardware that will help you help us figure this out? Were using the BS2 stamp and PBASIC 2.5, with the Sensirion humidity sensor and the DataLogger plugged into the white 'breadboard' (?). They are not directly wired or soldered together.
Are you by chace anywhere near Concord, New Hampshire (Boston? MIT?) I'd love to have you come to our team practice(s)-- or have my students visit with you--·to share your wealth of knowledge! Connecting with industry mentors is part of what the NASA Student Launch Initiative project is all about.
Regards from NH,
Mark
ioByte········· ·VAR···· B19············ ' Input/Output Storage
counter········ VAR···· W8············· ' Counter Variable
flag·············· VAR···· B20.BIT0······· ' Event Status Flag
ioByte··········· VAR···· B13···················· ' data from/to SHT1x
·and
Below is the entire program...
'·· {$STAMP BS2}
'·· {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] Program Description ]
' This program demonstrates how to write some simple data to a comma-delimited
' file which could be imported into a spreadsheet such as Excel and plotted or
' charted.· This program requires the Memory Stick Datalogger to be connected
' as per the Quick-Start schematic in the documentation.· You can adjust the
' number of samples by changing the constant NumSamples.
'
' This program demonstrates the interface and conversion of SHT11 data to
' usable program values.·
'
' For detailed information on the use and application of the ** operator,
' see Tracy Allen's web page at this link:
'
' -- http://www.emesystems.com/BS2math1.htm
'
' For Tracy's SHT1x code [noparse][[/noparse]very advanced]:
'
' -- http://www.emesystems.com/OL2sht1x.htm
'
' For SHT11/15 documentation and app notes, visit:
'
' -- http://www.sensirion.com
'
[noparse][[/noparse] I/O Definitions ]
ShtData········ PIN···· 1······················ ' bi-directional data
Clock·········· PIN···· 0······················ ' clock (for Sensirion)
TX············· PIN···· 8·············· ' Transmit Data·· --> 27937.4 (RXD)
RTS············ PIN···· 9·············· ' Request To Send --> 27937.6 (CTS)
RX············· PIN···· 10············· ' Receive Data··· <-- 27937.5 (TXD)
CTS············ PIN···· 11············· ' Clear To Send·· <-- 27937.2 (RTS)
'
[noparse][[/noparse] Constants ]
Baud··········· CON···· 84············· ' Serial Baud Rate 9600 bps (BS2)
NumSamples····· CON···· 15*60·········· ' Number Of Samples To Log (15 minutes)
ShtTemp········ CON···· %00011················· ' read temperature
ShtHumi········ CON···· %00101················· ' read humidity
ShtStatW······· CON···· %00110················· ' status register write
ShtStatR······· CON···· %00111················· ' status register read
ShtReset······· CON···· %11110················· ' soft reset (wait 11 ms after)
Ack············ CON···· 0
NoAck·········· CON···· 1
No············· CON···· 0
Yes············ CON···· 1
DegSym········· CON···· 186···················· ' degrees symbol for DEBUG
'
[noparse][[/noparse] Variables ]
' Note: Because the variables are shared between the Sensirion and the
'······ Memory Stick Datalogger, they're assigned manually rather than
'······ letting the compiler do it.· In particular, the Input Buffer is
'······ used for the Sensirion data since it's not used at the same time.
buffer········· VAR···· B0············· ' Input Buffer (B0 - B15)
index·········· VAR···· B18············ ' Index Variable
ioByte········· VAR···· B19············ ' Input/Output Storage
counter········ VAR···· W8············· ' Counter Variable
flag··········· VAR···· B20.BIT0······· ' Event Status Flag
ioByte········· VAR···· B13···················· ' data from/to SHT1x
ackBit········· VAR···· B15.BIT0··············· ' ack/nak from/to SHT1x
toDelay········ VAR···· B14···················· ' timeout delay timer
timeOut········ VAR···· B15.BIT1··············· ' timeout status
soT············ VAR···· W0····················· ' temp counts from SHT1x
tC············· VAR···· W1····················· ' temp - celcius
tF············· VAR···· W2····················· ' temp - fahrenheit
soRH··········· VAR···· W3····················· ' humidity counts from SHT1x
rhLin·········· VAR···· W4····················· ' humidity; linearized
rhTrue········· VAR···· W5····················· ' humidity; temp compensated
status········· VAR···· B12···················· ' SHT1x status byte
'
[noparse][[/noparse] Initialization ]
GOSUB SHT_Connection_Reset··················· ' reset device connection
DEBUG CLS, "Initializing..."
PAUSE 250······························ ' Allow Time To Settle
HIGH TX································ ' Initialize Transmit Line
LOW RTS································ ' Take Vinculum Out Of Reset
PAUSE 600······························ ' Allow Time To Settle
DEBUG "Done!", CR, "Synchronizing..."
DO
· SEROUT TX\CTS, Baud, [noparse][[/noparse]"E", CR]······· ' Sync Command Character
· GOSUB Get_Data······················· ' Get Response
· PAUSE 250
LOOP UNTIL ioByte = $0D················ ' Wait For Carriage Return
DO
· SEROUT TX\CTS, Baud, [noparse][[/noparse]"e", CR]······· ' Sync Command Character
· GOSUB Get_Data······················· ' Get Response
· PAUSE 250
LOOP UNTIL ioByte = $0D················ ' Wait For Carriage Return
'
[noparse][[/noparse] Program Code ]
Main:
· DEBUG "Done", CR, "Switching to Short Command Mode..."
· SEROUT TX\CTS, Baud, [noparse][[/noparse]"SCS", CR]····· ' Switch To Short Command Mode
· GOSUB Get_Data······················· ' Purge Receive Buffer
· DEBUG "Done!", CR, "Waiting for Memory Stick..."
Check_Drive:
· DO
··· SEROUT TX\CTS, Baud, [noparse][[/noparse]CR]·········· ' Prompt Device For Status
··· GOSUB Get_Data····················· ' Purge Receive Buffer
··· IF buffer(0) = ">" THEN············ ' Check For Ready Prompt
····· EXIT····························· ' If Ready Then Exit Loop
··· ELSEIF buffer(0) = "N" AND buffer(1) = "D" THEN
····· DEBUG "."························ ' Device Ready But No Memory Stick
··· ELSEIF buffer(0) = "D" AND buffer(1) = "D" AND flag = 0 THEN
····· DEBUG "Connected!", CR, "Accessing..."
····· flag = 1························· ' Memory Stick Ready
··· ELSE
····· DEBUG "."
··· ENDIF
··· PAUSE 250·························· ' Command Retry Delay
· LOOP
· DEBUG "Ready!", CR
· DEBUG "Opening Data File..."········· ' First Delete File
· SEROUT TX\CTS, Baud, [noparse][[/noparse]$07, $20, "datafile.txt", CR]
· GOSUB Get_Data······················· ' Purge Receive Buffer
······································· ' Then Create File
· SEROUT TX\CTS, Baud, [noparse][[/noparse]$09, $20, "datafile.txt", CR]
· GOSUB Get_Data······················· ' Purge Receive Buffer
Heater_On:
· DEBUG "SHT1x heater on", CR
· status = %00000100··························· ' heater bit = On
· GOSUB SHT_Write_Status
· DEBUG "Open!", CR, CR, "Writing Data...", CR
· FOR counter = 1 TO NumSamples········ ' Number Of Samples To Log
·
··· GOSUB SHT_Measure_Temp
··· GOSUB SHT_Measure_Humidity
··· DEBUG "#",counter," ",DEC tC,", ",DEC rHLin,CR,LF
··· SEROUT TX\CTS, Baud, [noparse][[/noparse]DEC tC, ",", DEC rHLin, CR, LF]
··· PAUSE 1000························· ' Write Results/Delay
··· GOSUB Get_Data····················· ' Purge Receive Buffer
· NEXT
· DEBUG "Closing Data File...Program Complete!"
· SEROUT TX\CTS, Baud, [noparse][[/noparse]$0A, $20, "datafile.txt", CR]
· GOSUB Get_Data······················· ' Purge Receive Buffer
Heater_Off:
· DEBUG "SHT1x heater off", CR, CR
· status = %00000000··························· ' heater bit = Off
· GOSUB SHT_Write_Status·
· STOP
'
[noparse][[/noparse] Subroutines ]
Get_Data:
· index = 0···························· ' Reset Index Pointer
· DO··································· ' Receive Data
··· SERIN RX\RTS, Baud, 100, Timeout, [noparse][[/noparse]ioByte]
··· buffer(index) = ioByte············· ' Add Received Byte To Buffer
··· index = index + 1·················· ' Increment Index Pointer
··· IF index > 14 THEN Timeout········· ' Check For Overflow
· LOOP
Timeout:
· RETURN
' connection reset: 9 clock cyles with ShtData high, then start sequence
'
SHT_Connection_Reset:
· SHIFTOUT ShtData, Clock, LSBFirst, [noparse][[/noparse]$FFF\9]
' generates SHT1x "start" sequence
'········· _____········ _____
' ShtData······ |_______|
'············· ___···· ___
' Clock··· ___|·· |___|·· |___
'
SHT_Start:
· INPUT ShtData································ ' let pull-up take line high
· LOW Clock
· HIGH Clock
· LOW ShtData
· LOW Clock
· HIGH Clock
· INPUT ShtData
· LOW Clock
· RETURN
' measure temperature
' -- celcius = soT * 0.01 - 40
' -- fahrenheit = soT * 0.018 - 40
'
SHT_Measure_Temp:
· GOSUB SHT_Start······························ ' alert device
· ioByte = ShtTemp····························· ' temperature command
· GOSUB SHT_Write_Byte························· ' send command
· GOSUB SHT_Wait······························· ' wait until measurement done
· ackBit = Ack································· ' another read follows
· GOSUB SHT_Read_Byte·························· ' get MSB
· soT.HighByte = ioByte
· ackBit = NoAck······························· ' last read
· GOSUB SHT_Read_Byte·························· ' get LSB
· soT.LowByte = ioByte
· ' Note: Conversion factors are multiplied by 10 to return the
· '······ temperature values in tenths of degrees
· tC = soT / 10 - 400·························· ' convert to tenths C
· tF = soT ** 11796 - 400······················ ' convert to tenths F
· RETURN
' measure humidity
'
SHT_Measure_Humidity:
· GOSUB SHT_Start······························ ' alert device
· ioByte = ShtHumi····························· ' humidity command
· GOSUB SHT_Write_Byte························· ' send command
· GOSUB SHT_Wait······························· ' wait until measurement done
· ackBit = Ack································· ' another read follows
· GOSUB SHT_Read_Byte·························· ' get MSB
· soRH.HighByte = ioByte
· ackBit = NoAck······························· ' last read
· GOSUB SHT_Read_Byte·························· ' get LSB
· soRH.LowByte = ioByte
· ' linearize humidity
· '·· rhLin = (soRH * 0.0405) - (soRH^2 * 0.0000028) - 4
· '
· ' for the BASIC Stamp:
· '·· rhLin = (soRH * 0.0405) - (soRH * 0.004 * soRH * 0.0007) - 4
· '
· ' Conversion factors are multiplied by 10 and then rounded to
· ' return tenths
· '
· rhLin = (soRH ** 26542)
· rhLin = rhLin - ((soRH ** 3468) * (soRH ** 3468) + 50 / 100)
· rhLin = rhLin - 40
· ' temperature compensated humidity
· '·· rhTrue = (tC - 25) * (soRH * 0.00008 + 0.01) + rhLin
· '
· ' Conversion factors are multiplied by 100 to improve accuracy and then
· ' rounded off.
· '
· rhTrue = ((tC / 10 - 25) * (soRH ** 524 + 1) + (rhLin * 10)) + 5 / 10
· RETURN
' sends "status"
'
SHT_Write_Status:
· GOSUB SHT_Start······························ ' alert device
· ioByte = ShtStatW···························· ' write to status reg command
· GOSUB SHT_Write_Byte························· ' send command·
· ioByte = status
· GOSUB SHT_Write_Byte
· RETURN
' returns "status"
'
SHT_Read_Status:
· GOSUB SHT_Start······························ ' alert device
· ioByte = ShtStatW···························· ' write to status reg command
· GOSUB SHT_Read_Byte·························· ' send command·
· ackBit = NoAck······························· ' only one byte to read
· GOSUB SHT_Read_Byte
· RETURN
' sends "ioByte"
' returns "ackBit"
'
SHT_Write_Byte:
· SHIFTOUT ShtData, Clock, MSBFirst, [noparse][[/noparse]ioByte]·· ' send byte
· SHIFTIN· ShtData, Clock, LSBPre, [noparse][[/noparse]ackBit\1]·· ' get ack bit
· RETURN
' returns "ioByte"
' sends "ackBit"
'
SHT_Read_Byte:
· SHIFTIN· ShtData, Clock, MSBPre, [noparse][[/noparse]ioByte]···· ' get byte
· SHIFTOUT ShtData, Clock, LSBFirst, [noparse][[/noparse]ackBit\1] ' send ack bit
· INPUT ShtData································ ' release data line
· RETURN
' wait for device to finish measurement (pulls data line low)
' -- timeout after ~1/4 second
'
SHT_Wait:
· INPUT ShtData································ ' data line is input
· FOR toDelay = 1 TO 250······················· ' give ~1/4 second to finish
··· timeOut = Ins.LowBit(ShtData)·············· ' scan data line
··· IF (timeOut = No) THEN SHT_Wait_Done······· ' if low, we're done
··· PAUSE 1
· NEXT
SHT_Wait_Done:
· RETURN
' reset SHT1x with soft reset
'
SHT_Soft_Reset:
· GOSUB SHT_Connection_Reset··················· ' reset the connection
· ioByte = ShtReset···························· ' reset command
· ackBit = NoAck······························· ' only one byte to send
· GOSUB SHT_Write_Byte························· ' send it
· PAUSE 11····································· ' wait at least 11 ms
RETURN
Post Edited (Mike Green) : 1/28/2008 11:42:10 PM GMT
I'm in Minneapolis which is pretty far from New Hampshire although I have fond memories of New Hampshire in summer as a child when I lived in New Jersey. I'm sure there are other "experts" in Stamp programming in the Boston or maybe even the Concord area. Give Parallax a call. They may have contact information for other educators in your region.
Thanks for the update. It seems like I'm starting to understand a bit of PBASIC programming! I considered reassigning a number to the 'other' ioByte command (like ioByte2, as you did.) I'll download this into the program and run it and see what happens.
What does 'expected a label' mean (other than the obvious?) We get this 'error message' (?) further down in the program (where it says "SERIN RX\RTS, Baud, 100, Timeout, [noparse][[/noparse]ioByte]" for example. Does re-numbering the 'ioByte' remedy this?
As an aside, my students made an hour-long video teleconference to NASA today about their project! I have 7th grader, an 8th grader, a 9th grader, three sophomores, and a junior on the team. Half are boys and half are girls. In their teleconference they had to discuss (and defend) any criticaldesign changes since their last report. Young Andrew did quite the job of explaining how we are trying to get the robot program by seeking on-line help. Thanks, Mike! You are a de facto part of a NASA project!
Mark
Changing 'ioByte' to ioByte2' gets us past that part of the program OK now. But we're getting the same 'expected a label' message further down in the program at: 'Timeout', then at 'buffer'
Mark
DO ' Receive Data
SERIN RX\RTS, Baud, 100, Timeout, [noparse][[/noparse]ioByte]
buffer(index) = ioByte ' Add Received Byte To Buffer
index = index + 1 ' Increment Index Pointer
Turning the heater on just before making the measurement creates a non-equilibrium condition. The heater can help to drive off condensation, but that should be done sparingly and not as part of a measurement.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
· What's your read on the program we're trying to write (above)? Can you help us get it working? We'll turn the heater off in the program then, since we do want to measure ambient temperature.
Thanks,
Mark
I looked earlier in the thread and saw this
Change the two instances of "ioByte" to "ioByte1" and make sure the last two lines of the above are present in your version.
Post Edited (Mike Green) : 1/29/2008 2:06:19 AM GMT
I changed the two instances of 'ioByte' to 'ioByte1', and checked to make sure the program lines 'Timeout:' and RETURN were there as you suggested. Ran the program but it still says, "expected a label" after 'Timeout'. (*At the beginning of the program it's timeOut with a capital 'O'). I deleted 'timeout' and ran it again. It still gives the 'expecetd a label' message, but after the word 'buffer' (below)
Mark
DO ' Receive Data
SERIN RX\RTS, Baud, 100, Timeout, [noparse][[/noparse]ioByte]
buffer(index) = ioByte ' Add Received Byte To Buffer
index = index + 1 ' Increment Index Pointer
Timeout is used both as a label
timeout:
RETURN
and as a variable.
timeOut VAR B15.BIT1 ' timeout status
That is why the program complains that it "expected a label". Change the second one to
timeOutBit VAR B15.BIT1 ' timeout status
Also change the two instances where that variable occurs in the SHT_Wait: subroutine. This is all part of debugging a program!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks for your post. I made the changes you suggested, with mixed results. The program now RUNS without any error messages (which seems like progress to a neophyte rookie wannabe programmer.) However, it outputs the data as 235, 262, etc., on the computer screen as it replaces text lines, in different places on the screen from top to bottom. The numbers are not recognizable as degress Celsius or percent humidity. The data is NOT stored on the DataLogger. After the program runs and outputs however many data points it's supposed to (we'll say 10), the program 'loops' (?) and reinitializes.
I really do appreciate your and Mike's help, and I certainly don't want to be a pest. But I'm tabula rasa new to programming and so any help we can get is very much appreciated. We'll learn, slowly, as we go, adn as you teach us. Thank you for your time, patience, and replies.
Regards,
Mark
You said to "change the second 'timeout' to timeOutBit VAR B15.BIT1 ' timeout status
I did that (at the top of the program)
You also said to "change the two instances where that variable occurs in the SHT_Wait: subroutine" (end of the program.) This is unclear
In the SHT_Wait: subroutine the two 'timeout' instances are
timeOutbit = INS.LOWBIT (Shtdata), and
timeOutbit = No
Do I change both of those to timeOutBit VAR B15.BIT1
What exactly is debugging? Before I ever started this I thought it meant to "work the bugs out of a faulty program." But after I saw PBASIC program language it seemed like DEBUG was some sort of a line command prompt. Does 'debugging'mean both?
Thanks,
Mark
....sorry [noparse];)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
And I'm all for 'mothballing' the computer (or, at this juncture, our six·Parallax boards, sensors, and DataLoggers.)·Debugging certainly is a tedious and iterative process. I have a headache, and I feel like I scarely know much more than when I first logged on to the forum. I'm stumped (*are there bugs in stumps, too? Please tell me 'No!')·Please help us figure out this program. I have too many exams to grade, and lesson plans to write. I've been at this 'til midnight the past·four 'evenings'. I'm even dreaming about 'bugs' (not really!)·
Sleepless in New Hampshire,
Mark (and the Rocket Team kids, who are home asleep)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
It compiles on my MacBS2, but I have no way to test it. It should display samples from the Sensirion
in the debug window of the Stamp Editor and it should write them to a file on the memory stick.
If it doesn't, make a note of the messages it displays. You can copy the messages from the debug
window and paste them into a text editor window or mail window to post with your reply.
··· That makes sense, and it helps me understand programming a bit better so I can (try to) explain it to my students. I don't teach computer science, and electonics confuse me. I teach earth and space science, and physics. But it's all integrated, isn't it?
Any ideas on how to get our program fully functional (see posts above)? It seems that we're almost there, but we still have a few bugs to work out. Wish I understood the langauge and logic of programming better...! Thanks for your reply.
Good morning,
Mark
SEROUT TX\CTS, Baud, [noparse][[/noparse]$8,$20,0,0,0,DEC 11,CR,DEC4 tC, ",", DEC4 rHLin, CR, LF,CR]
that will duplicate the information from the debug instruction in Mikes RocketRobotProgram for logging. It will log 4 digits for tC and rHlin with leading zeros.
Stepping ahead a little, in the original SHT11 program the decimal places were displayed. Taking the debug instruction from that program would give you this string
SEROUT TX\CTS, Baud, [noparse][[/noparse]$8,$20,0,0,0,DEC 13,CR,DEC3 (tC / 10),".", DEC1 tC,",",DEC3 (rhLin / 10),".",DEC1 rhLin,CR,LF,CR]
that will log 3 digits with leading zeros plus one decimal place.
Jeff T.
·· Thanks for posting the updated version of 'RocketRobot'. It writes the following data-- to the computer screen-- but not to the flash drive:
1, 252, 233
2, 252, 234
3, 251, 233
4, 251, 232, etc., etc.
I'm (still) stumped. I sense we're (you, that is) are getting close. The glitch (bug!) now seems to be getting the data to write to the flash drive. I'm headed back to the circuit board and laptop, trying to figure it all out. The nice sales guy at Parallax is sending me a copy of (in his words) "Programming for Dummies."·
Mark
· Thanks for your comments! Seeking out a local mentor to teach us program code is an excellent suggestion. I wish I had the time. You can't·believe the challenges and realities of teaching middle school; coaching THREE rocketry teams (two at the middle school, one at the high school); being a Boy Scout scoutmaster; serving on numerous school committees; helping with basketball games... AND trying to figure programming every night until midnight. (And tend to my wfe and son.)
Those of you who post helpful replies and hints: YOU, too·are my students' teachers and mentors! "It takes a community to raise a child" as they say. In this Age of Technology, reaching out to experts through the internet helps make the most of limited resources (time, for one.) We are a small, rural New·Hampshire school. Boston is an hour away and we only meet once a week.·BUT! The students DO read your posts, and·they're working at home·the other six days that we don't meet, scratching their heads in confusion and amazement like me, trying to learn programming from you.
Your suggestion is most appreciated, PAR. I'll look for help locally as we reach out to you. "It takes a coomunity to raise a child", and you are part of our community. Thank you,
Mark