Streaming

38 skatījumi
Pāriet uz pirmo nelasīto ziņojumu

Jack Rickard

nelasīta,
2016. gada 23. sept. 13:23:0123.09.16
uz devel...@arduino.cc
I've watched literally dozens of updates to Arduino IDE over the years.  Long ago someone posted a template to do some basic streaming and I've had to copy this over countless programs.

template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; } //Lets us stream SerialUSB


It simply lets me send streams out a serial port.

SerialUSB<<"\nLet's show some data:"<<somedata<<" and maybe some more data:"<<someMoreData<<"\n\n";

I kind of thought someone at some point along the way would have added such very basic streaming to Arduino.  ????

Jack Rickard

--
--------------------------------
---------------------------------

Alexander Brevig

nelasīta,
2016. gada 23. sept. 13:33:4523.09.16
uz Arduino Developers
My 0x01 is that the << syntax is very different from the over all design philosophy of Wiring and Arduino. Plus, it's such an easy addition for those of us who wants the ability to stream like that. Features such like these tend to creep as you'll soon want formatting and maybe also the corresponding >> ?

My vote is to hide this weird operator from the users.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Andrew Kroll

nelasīta,
2016. gada 23. sept. 13:34:4723.09.16
uz devel...@arduino.cc

Personally I think it makes the code look ugly and confusing. I don't think a new user will grasp the concept at all.

Tyler Freeman

nelasīta,
2016. gada 23. sept. 13:44:2123.09.16
uz devel...@arduino.cc

How does it buffer for the USB? Is it blocking?


On Fri, Sep 23, 2016, 10:34 Andrew Kroll <xxx...@gmail.com> wrote:

Personally I think it makes the code look ugly and confusing. I don't think a new user will grasp the concept at all.

On Sep 23, 2016 1:33 PM, "Alexander Brevig" <alexand...@gmail.com> wrote:
My 0x01 is that the << syntax is very different from the over all design philosophy of Wiring and Arduino. Plus, it's such an easy addition for those of us who wants the ability to stream like that. Features such like these tend to creep as you'll soon want formatting and maybe also the corresponding >> ?

My vote is to hide this weird operator from the users.
On Fri, Sep 23, 2016 at 7:22 PM, Jack Rickard <ja...@evtv.me> wrote:
I've watched literally dozens of updates to Arduino IDE over the years.  Long ago someone posted a template to do some basic streaming and I've had to copy this over countless programs.

template<class T> inline Print &operator <<(Print &obj, T arg) { obj.print(arg); return obj; } //Lets us stream SerialUSB


It simply lets me send streams out a serial port.

SerialUSB<<"\nLet's show some data:"<<somedata<<" and maybe some more data:"<<someMoreData<<"\n\n";

I kind of thought someone at some point along the way would have added such very basic streaming to Arduino.  ????

Jack Rickard

--
--------------------------------
---------------------------------

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

Paul Carpenter

nelasīta,
2016. gada 24. sept. 05:00:2124.09.16
uz Developers
It is probably inherently just as blocking just like the Print it calls  as most of the classes are.except to interupts

Even basic Serial.Print and Serial.write are

Jack Rickard

nelasīta,
2016. gada 24. sept. 10:13:3424.09.16
uz devel...@arduino.cc
IT is hardly a "wierd" operator.  Streaming is just all over C++ and the Arduino interface uses G++ and virtually IS C++ without STL.  Obviously someone wanted it as this template was published probably four or five years ago and I know a number of people who don't start a program without it.

Your opinions as to the aesthetics of C++ are of course of deep interest.

Just curious why it has never been picked up.  I guess I think I now know....

Jack 

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

Adrian Godwin

nelasīta,
2016. gada 24. sept. 10:17:0824.09.16
uz devel...@arduino.cc
If there's room for improved formatting support, I'd go for printf() every time. Unlike the clumsy C++ formatting, you can actually get an idea of what the output will look like from the source code.


On Sat, Sep 24, 2016 at 3:13 PM, Jack Rickard <ja...@evtv.me> wrote:
IT is hardly a "wierd" operator.  Streaming is just all over C++ and the Arduino interface uses G++ and virtually IS C++ without STL.  Obviously someone wanted it as this template was published probably four or five years ago and I know a number of people who don't start a program without it.

Your opinions as to the aesthetics of C++ are of course of deep interest.

Just curious why it has never been picked up.  I guess I think I now know....

Jack 

Andrew Kroll

nelasīta,
2016. gada 24. sept. 12:04:1424.09.16
uz devel...@arduino.cc

Adrian Godwin +1


On Sat, Sep 24, 2016 at 10:17 AM, Adrian Godwin <artg...@gmail.com> wrote:
If there's room for improved formatting support, I'd go for printf() every time. Unlike the clumsy C++ formatting, you can actually get an idea of what the output will look like from the source code.

On Sat, Sep 24, 2016 at 3:13 PM, Jack Rickard <ja...@evtv.me> wrote:
IT is hardly a "wierd" operator.  Streaming is just all over C++ and the Arduino interface uses G++ and virtually IS C++ without STL.  Obviously someone wanted it as this template was published probably four or five years ago and I know a number of people who don't start a program without it.

Your opinions as to the aesthetics of C++ are of course of deep interest.

Just curious why it has never been picked up.  I guess I think I now know....

Jack 

On Sat, Sep 24, 2016 at 4:00 AM, Paul Carpenter <pa...@pcserviceselectronics.co.uk> wrote:
It is probably inherently just as blocking just like the Print it calls  as most of the classes are.except to interupts

Even basic Serial.Print and Serial.write are


On Friday, 23 September 2016 18:44:21 UTC+1, Tyler F wrote:

How does it buffer for the USB? Is it blocking?

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.



--
--------------------------------
---------------------------------

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.



--
Visit my github for awesome Arduino code @ https://github.com/xxxajk

Massimo Banzi

nelasīta,
2016. gada 24. sept. 12:08:5324.09.16
uz Arduino Developers
In general our objective is to be as compatible as possible with processing

It has never been officially added  because we don’t like that syntax but there are libraries that use it/implement it


m


--
Massimo Banzi <m.b...@arduino.cc>
Arduino LLC



--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

follower

nelasīta,
2016. gada 24. sept. 12:10:0424.09.16
uz Arduino Developers
[Well, I've already got this written so I might as well send it. ;) ]

On 25 September 2016 at 03:13, Jack Rickard <ja...@evtv.me> wrote:
> Just curious why it has never been picked up.
The primary reason is that the streaming operator is not seen by the
core Arduino dev team as being compatible with the stated goal:
"Arduino aims to make technology accessible and useful to new
audiences such as artists, designers, or hobbyists." (via
<https://github.com/arduino/Arduino/wiki/Development-Policy>.

Also somewhat related from "Writing Example Code" section of
<https://www.arduino.cc/en/Reference/StyleGuide>: "When forced to
choose between technically simple and technically efficient, choose
the former."

(I seem to recall there used to be a more explicitly stated
acknowledgement that the Arduino IDE and language was always going to
put the experience of new people ahead of the desires of experienced
software developers but I can't find it currently.)

Discussions on the stream operator have a long history (at least as
far back as 2009) and there is a reference to Massimo stating a
preference against it on the mailing list
(<http://forum.arduino.cc/index.php?topic=46643.msg336967#msg336967>)
but I can't find the post in question for you.

So, the short answer: The Arduino development team has stated a belief
that the stream operator would be confusing for beginner programmers
and that for the goals of the project clarity is more important than
efficiency of code or keystrokes.

--Philip;

Andrew Kroll

nelasīta,
2016. gada 24. sept. 12:15:4224.09.16
uz devel...@arduino.cc
You could always write a library. I did exactly this for printf and printf_P and place it on github to see where it goes acceptance-wise. :-)
It supports *MANY* platforms, including:
ALL Arduino
ALL PJRC Teesny
ALL Digilent boards

I've wrapped it up into the latest UHS3 as a convenience, but may be used separately.
https://github.com/felis/UHS30/blob/master/libraries/UHS_host/UHS_printf_HELPER.h




--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.



--

Jack Rickard

nelasīta,
2016. gada 24. sept. 14:44:2524.09.16
uz devel...@arduino.cc
Thank you Andrew.  Very nice.

Jack Rickard
--------------------------------
---------------------------------

Jack Rickard

nelasīta,
2016. gada 24. sept. 14:45:0024.09.16
uz devel...@arduino.cc
Thank you Massimo.  Simple enough and just what I needed.

Jack Rickard

To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.

--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+unsubscribe@arduino.cc.
Atbildēt visiem
Atbildēt autoram
Pārsūtīt
0 jauni ziņojumi