Go Down

Topic: Serial.readBytesUntil() (Read 3125 times) previous topic - next topic

Delta_G

#45
Aug 08, 2017, 10:17 pm Last Edit: Aug 08, 2017, 10:17 pm by Delta_G
Quote
(I have a pet peeve about taking classes at $$$$$$$$ per credit, only to sit for 3 hours per week and listen to the professor read from the textbook. I want to be taught, not read to.)
If you would take a slightly different view of this, you'd see that this is what that looks like.  You do your best to stick in the functions that @Robin is talking about and when it doesn't work you post it back up and someone helps you figure out what you did wrong.  Then you get to learn from your mistakes, which is really the best way to learn.  You get to see what parts you don't understand and you get to ask questions about things until you do understand it.  And understanding IS the goal of learning right?

What you don't do is just say, "I tried that, didn't work, gimme something else".  If we would just take your code, fix it, and hand it back to you all nice and neat and working, that would be like the professor just reading the answers to you.  From this quote, you obviously understand how that works. 

In order for the student to learn, he must want to learn.  You do the learning.  The teacher does the teaching.  But the teacher can't make you learn it.  They can only try to help facilitate that process. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Delta_G

Also keep in mind that you didn't pay anyone here anything and nobody here owes you anything.  If we wanted to start posting cute cat videos all over this thread that doesn't violate any agreement that anyone ever had with you.  Now, I don't think things are going to go to that level.  That would be ridiculous.  But I don't think you can really get mad because the FREE help you got from a bunch of strangers wasn't up to your standard. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

adwsystems

If you would take a slightly different view of this, you'd see that this is what that looks like.  You do your best to stick in the functions that @Robin is talking about and when it doesn't work you post it back up and someone helps you figure out what you did wrong.  Then you get to learn from your mistakes, which is really the best way to learn.  You get to see what parts you don't understand and you get to ask questions about things until you do understand it.  And understanding IS the goal of learning right?

What you don't do is just say, "I tried that, didn't work, gimme something else".  If we would just take your code, fix it, and hand it back to you all nice and neat and working, that would be like the professor just reading the answers to you.  From this quote, you obviously understand how that works.  
You hit the nail on the head. The person trying to "teach" needs to provide more than just the answers. To learn and understand the explanation needs to be provided. Only in four posts was anything explained, especially including the post on serialeventrun. The remainder of the posts were 'here is the answer, just do it'.

Once you (all) got me the correct information on serialEvent() (ie., that I was misled to believe it was an ISR). I moved on to the Serial.available() method as mentioned. I did say, I tried the code [mentioned[ and that it didn't work. At the same time, I spent the time figuring out how to get it to work. I bother posting the non-working sketch because I wanted to, and did, figure out how to make it work. So I skipped a few steps (including posting the non-working code originally, though did finally after repeated requests), and instead posted "AH HA!" I got it working and here is the result.


Delta_G

You hit the nail on the head. The person trying to "teach" needs to provide more than just the answers. To learn and understand the explanation needs to be provided. Only in four posts was anything explained, especially including the post on serialeventrun. The remainder of the posts were 'here is the answer, just do it'.
You're still putting the onus on the teacher.  IT is the STUDENTS responsibility to learn.  Robin has shown more than a few people how to work with Serial data.  He was telling you to "try this" not as an answer but as a learning exercise.  If you can't see that, then you're going to have a hard time learning to code.  What you're asking for is, "tell me the explanation" or in other words, "read it to me."  But as we've already discussed, that's not what you want.  Would it make more sense to you had Robin said, "Try this and you might learn something" instead of just "Try this".  To me it seems like most of the wasted space on this thread isn't people giving you bad advise, it's people trying to get through your combative attitude towards the advise they gave. 

US- "Here try this way"
YOU- "I don't want to"
US- "Just try it, it will work if you do it right"
YOU- "No, I don't like that method I want this other one"
US- "But it won't work for you, why don't you at least try this"
YOU -"Well I copied it and it didn't work, poo on you why aren't you trying to help me"
US- "We are, show us what went wrong and we can help you fix it right"
YOU- "But I wanted something I could just copy in.  You didn't say there'd be more work"
US- "Well you obviously did something wrong, why don't you let us help you?"
YOU- "Why would I ever show you what I tried"
US-  "So we can help you understand and fix it."
YOU- "I don't want you to just explain it to me and give me the answer, I want you to just explain it to me and give me the answer"
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Delta_G

#49
Aug 09, 2017, 12:53 am Last Edit: Aug 09, 2017, 12:55 am by Delta_G
Imagine a different story:



US - "Here try this"
YOU - "I tried it, but it didn't work.  Here look at it.  Can you show me what I did wrong?"
US - "Oh you left this little thing out.  Fix it here and try again"
YOU - "OK, but it still gives this little error"
US - "Oh, because you did this little thing wrong.  Here is an explanation for why it works this way and not that"
YOU - "Oh now I get it.  Cool now I can parse Serial in any program I ever write."
EVERYONE TOGETHER - "Yaaaaayyyy"


Wouldn't that have been better?  The only difference is a student who is trying to learn instead of being combative about what he thinks he is owed by a bunch of strangers he hasn't ever done diddly-squat for. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

adwsystems

#50
Aug 09, 2017, 01:11 am Last Edit: Aug 09, 2017, 01:16 am by adwsystems
Imagine a different story:

US - "Here try this"
YOU - "I tried it, but it didn't work.  Here look at it.  Can you show me what I did wrong?"
US - "Oh you left this little thing out.  Fix it here and try again"
YOU - "OK, but it still gives this little error"
US - "Oh, because you did this little thing wrong.  Here is an explanation for why it works this way and not that"
YOU - "Oh now I get it.  Cool now I can parse Serial in any program I ever write."
EVERYONE TOGETHER - "Yaaaaayyyy"

Wouldn't that have been better? The only difference is a student who is trying to learn instead of being combative about what he thinks he is owed by a bunch of strangers he hasn't ever done diddly-squat for.
Sure. Too bad that wasn't the way the thread started. The student asked a question and got an explanation then was handed an answer over and over to question that was never asked without explanation of why that was the way to do it. Yes, if pushed, I push back. Explain and I will follow. As for parsing serial, I don't know how many serial parsers I have written. In this particular case, I was trying to find the shortest way to convert a working program from using blocking code to non-blocking code without breaking it too much while trying to avoid starting all over since the blocking program works with the PC program already.

I'm putting the onnus on both. It is a two way street. The student must be able to learn and the teacher must provide the information (not the answer) to learn from. 40+ posts here are the teacher providing the answer key, not the explanation. SerialInputBasics explains the code but not the basis behind it. I had to reverse engineer it to understand the basis in order to adapt it to the PLX-DAQ program. From the first post, it was a matter of how to do it the Arduino way. As we have discussed elsewhere, the issue I have is getting the background on the differences doing it the Arduino way versus coding everything from scratch. I don't need to learn to code, I need to learn to program the Arduino way. (P.S. I have eclipse downloaded, but won't have the time in the next two projects to make it the primary IDE)

Almost but not quite, missing some context, and some lines far off I'm not sure they landed in this thread.
US- "Here try this way"
YOU- "I don't want to"
US- "Just try it, it will work if you do it right"
YOU- "No, I don't like that method I want this other one"
US- "But it won't work for you, why don't you at least try this"
YOU -"Well I copied it and it didn't work, poo on you why aren't you trying to help me"
US- "We are, show us what went wrong and we can help you fix it right"
YOU- "But I wanted something I could just copy in.  You didn't say there'd be more work"
US- "Well you obviously did something wrong, why don't you let us help you?"
YOU- "Why would I ever show you what I tried"
US-  "So we can help you understand and fix it."
YOU- "I don't want you to just explain it to me and give me the answer, I want you to just explain it to me and give me the answer"
(retaining the perspective for continuity)

This is a little more realistic.
YOU - "Is Serial.readxxxUntil() blocking"
US - "Yes. Do it this way"
YOU - "I want to use serialEvent()"
US- "Here try this way"
YOU- "I don't want to. I want to use serialEvent()"
US- "Just try it, it will work if you do it right" (won't everything)
YOU- "No, I don't like that method I want to use serialEvent()" (recall, I was expecting serialEvent() to be an ISR)
US- "Show us your code."
YOU - *Here's the code.
US - ' Why don't you "have all the serial handling code in its own function"
YOU - "Like encapsulated in serialEvent() as shown in the reference section?
US - "serialEvent is not and ISR. See here's the code."
YOU - "Oh! OK. Thanks for setting me straight. Here's my new code using Serial.available()'
US - "WHY DIDN'T YOU JUST USE THE CODE IN THE LINK?"
YOU -"Fine. I'll try it..........Well I copied it. It didn't work, poo on you. I fixed it myself."
US- "Show us what went wrong and we can help you fix it right"
YOU- "I was told what to change, copy and go. There was so much much more to it, I reverse engineered it and implemented the most basal concepts."
US- "Well you obviously did something wrong, why don't you show us the broken program and let us help you?"
YOU- (confused) "Why do you want to see the broken code after I already have it working? How about critiquing the final working code?"
US-  "So we can help you understand and fix it."
YOU - "But I have already fixed it. If you insist in working through it yourself then help yourself. Here's the code from the point it was broke."


If you can't see that, then you're going to have a hard time learning to code.
Learning to code? I hope I have a good grasp on programming after nearly 40 years. What I don't have a grasp on is the integration of the "Arduino way" including those items behind the scenes or not documented as we have previously discussed.

Delta_G

How was anyone supposed to guess thatyou wanted it because it was interrupt driven?  I finally guessed at that and put it out there just in case that's what you were thinking.  Up to that point we had probably assumed that someone with 40 years of programming would be smart enough to read the docs.
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

Delta_G

But it's cool.  Since you seem like you'd rather just be combative I'll just leave you with your misconceptions in the future and go help someone who actually understands how advise on a FREE forum works.
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

adwsystems

#53
Aug 09, 2017, 01:42 am Last Edit: Aug 09, 2017, 01:58 am by adwsystems
After 25 years of posting on forums, I know well how they work. I have learned to keep the questions and responses short and to the point (recent posts aside) or the responders are liable to wonder off in irrelevant directions. See post #1, one line that's it.

That's difference between responding to posts by beginners versus the experience people. The beginners want the water, the experienced people want to know how to get to the water and why they should go that way. If you only give them the water and don't give them the directions and why you should follow them, they get resistive. All the "problems" in this thread stem from that concept.

40 years experience has nothing to do with reading documentation that doesn't exist. We both agree that level of information is not there.

Also a two-way miss. I was proceeding on the explanation I previously received (serialEvent is an ISR). Your educated guess was correct, that I was under the impression that serialEvent() is an ISR. But why would I ask a question I already have an answer to? How many times have you not asked a question because you already had the answer, only to find out you had the wrong information. Once you set me straight we moved along, but I was still badgered with "USE THE CODE IN THE LINK" without any explanation why. Until I submitted, tried it, failed, and then made it work. Then I was criticized for not asking for help when the code didn't work at first and then for not posting the broken code (which was fixed before I thought to post; ie. learning on my own).

I'm not sure whom is being combative in this thread, it seems like there is plenty to share.

Go Up