How to Extend Serial.print


Question 1.

A few days ago I came across a posting and I can not find it. It pertained to using Serial.print to send multiple enties with one Serial.print command. It went something like this:

Serial.print(“Ouput x =” << x << " Output y = " << y);

Question 2.

I am using the following code (slightly modified from,15963.0.html) to fade my shiftbrites. The original code cycles very fast. I tried to slow it down by increasing the delay. That worked but now it looks like it is stepping from each color instead of a nice smooth fade. I assumed I could change the void fadeall i to a higher number thus sampling more. But this caused the stepping. Any ideas?

Can anyone help me?  Thanks.

mejor epoca para viajar

Post YOUR program so we can see what you are actually using.


To try to answer question one.

The syntax is

Serial << "My name is " << name << " and I am " << age << " years old.";

No print and nor parenthesis.

if you want to slow down and print for certain second you can try

unsigned long time=millis()
if time + 30*60*1000 < millis() //and then send msg

you can add in the counting timing to do so it will count at certain time and doing the print like 10 sec print which sentence and 20 second print which sentence . And repeat and repeat.


unsigned long time=millis()

if time + 30601000 < millis() //and then send msg

This is not a good way to use millis() as it won’t work when millis() rolls over. Always use subtraction as illustrated in Several Things at a Time