Go Down

Topic: Reading from Serial1 requires that I write to Serial. Solved (Read 1 time) previous topic - next topic



Could you just explain one thing?

Why make a program so big it can't be posted that includes parts you do not have working, practiced understanding of?

I often wonder that, however I suspect that in many cases people copy large chunks of code from other examples, and bang them together. This will tend to lead to this effect. The smaller batches work on their own, but the large conglomerate doesn't.

In principle I totally agree with you, GoForSmoke. Let's say I am making a temperature sensor that reads the temperature and shows it on some LEDs, I will always test the sensor (via serial prints), the LEDs (with dummy data), and then once I am sure the "black boxes" work on their own, start connecting them together.

Or is using strtok() for the first time I actually used strtok() in small code then twisted and bent the example to see how it broke... and finally rolled my own routine that did what I needed.
Not that I have anything against strtok() or atoi(). Or especially in almost all languages I've written, in the standard input routines. It's just that once I got a few years into coding I wanted and needed better is all. As a result my stuff read keys and didn't wait for complete entry to flag errors or find match words when possible. I find that easier and faster than a bunch of buffered text manipulation. To be honest though I did put in a good bit of thought and work getting the first drafts right, it runs counter to top-down thinking.
I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Nick Gammon

You shouldn't need to delay, and you shouldn't need to "block". Read this:



You shouldn't need to delay, and you shouldn't need to "block". Read this:


Thanks, yes, now that I've understood what James was saying I've re-written my code in a way that removes the blocking and just reads until it hits the terminator. I think that's basically what's in the your link, too.

Go Up