Hot answers tagged

15

There is a class called Printable. If you inherit from that, and implement the size_t printTo(Print& p) function, your object can then be passed to the print functions: class myClass : public Printable { private: int _val1; int _val2; public: myClass(int v1, v2) : _val1(v1), _val2(v2) {} size_t printTo(Print& ...


6

The Stream class has pure virtual methods which must be implemented in derived not abstract class. The pure virtual method from base class Print is: virtual size_t write(uint8_t) = 0; The pure virtual methods from Stream are: virtual int available() = 0; virtual int read() = 0; virtual int peek() = 0; additionally add in your class the line using Print:...


3

No. HDMI uses multiple serial data streams at gigabit rates. No Arduino is ever going to do that sort of thing. If you want something programmable to do that kind of thing you need an FPGA.


2

What exactly is << doing in this case? It's directing the data into an output device (stream). http://www.cplusplus.com/doc/tutorial/basic_io/ Yes, it's confusing using the same symbols for more than one thing... Moreover, F seems to never be defined prior to this. F() is a macro. It's defined by the Arduino core in WString.h: #define F(...


2

In the Print class the virtual size_t write (uint8_t)=0 DEFINES and names a function that accepts a byte and returns a size. ANY "virtual" function in a base class CAN be over-ridden in a derived class; however, the =0 declares that there is NO actual function in the base class -- the compiler sticks a null function pointer there. This is why pure virtual ...


2

write is implemented in the class that inherits the Print class - such as HardwareSerial. There are a number of write functions, and they are overloaded, which means that they are all distinct functions identified using their parameters as well as their name (write(uint8_t) and write(uint8_t *, size_t) are different functions). The child class overrides ...


1

You could try using the most common solution for streaming low latency drone video, called FPV. You basically connect an AV video output from a camera to a transmitter and use a receiver on the ground to receive the AV video. After this you can connect it to any AV display (or a usb AV decoder if you want to use a computer) and you'll get an almost real time ...


1

You are right that you can't read the data fast enough with your method there. What you really need is the opposite of "shiftOut" - which happens to be called "shiftIn". You use it just like shiftOut, but instead of you sending it a value to send it instead returns a value that it reads. You trigger it using the "STB" pin: if (digitalRead(STB) == LOW) { ...


1

To address your confusion with the bitshift operator; It indeed is commonly used as a the arithmetic operator for bitshift, but appears to be 'overloaded', so that when used with streams, it is an 'insertion operator'. In particular, stream insertion and stream extraction overloads of operator<< and operator>> return T&. https://en....


Only top voted, non community-wiki answers of a minimum length are eligible