Skip to main content
6 votes

Printing the array using print and serial write function in Arduino Uno

Serial.write(some_byte) writes a byte on the serial output. The Arduino serial monitor tries to interpret the bytes it receives as text: 0x11 is a control character, displayed as “□” 0x22 is the ...
Edgar Bonet's user avatar
  • 44.3k
4 votes
Accepted

SyslogAppender for log4esp

Class Print is a base class of Arduino streaming. Stream is a derived class and adds reading capability. Print has only one abstract method write to write one byte to output or buffer. It is easy to ...
Juraj's user avatar
  • 18.2k
3 votes

Construct Strings with UTF-8 characters from data

As you have noticed, Serial doesn't know how to deal with wchar_t. If you are building your strings algorithmically from Unicode code points, you need to convert those code points to UTF-8 for ...
Edgar Bonet's user avatar
  • 44.3k
3 votes
Accepted

Int64_t aka long long acts as int32_t and overflows at 2^31

1 << 31 is interpreted by the compiler as (int)1 << (int)32. See the implicit types of integer literals. The rules of usual arithmetic conversions state that no implicit conversion is ...
Edgar Bonet's user avatar
  • 44.3k
3 votes
Accepted

Why can't I print boolean variable values (0 and 1) through println function?

First, you are not supposed to use boolean with digitalRead. The function prototype in Arduino.h is: int digitalRead(uint8_t); Thus, the correct data type for buttonState in your code is int. Then ...
Nick Gammon's user avatar
  • 38.7k
3 votes
Accepted

how can I send a variable to println?

Change: SIM900.println("AT+CMGS=\"591"numero"\""); to SIM900.print("AT+CMGS=\"591"); SIM900.print(numero); SIM900.println("\""); Note that only the final call is to println() (which just prints a ...
jose can u c's user avatar
  • 6,974
3 votes

Serial.print and char[] & null

The "Serial" is a object/class and that makes it possible to have more than one function for Serial.print(). According to the type of the parameter the proper Serial.print() is selected. This is the ...
Jot's user avatar
  • 3,246
3 votes

How can I get Serial.print to print a variable thats a char?

To make your code work, you must use character array pointers. A "char" holds only one character, while "char*" can point to a string. char foo = 'a'; char *bar = "string with lots of stuff."; So ...
Gary Brown's user avatar
2 votes

Help understanding Print::write()--it calls write()--where is write() defined? Help reading code

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 ...
Byron's user avatar
  • 21
2 votes
Accepted

Help understanding Print::write()--it calls write()--where is write() defined? Help reading code

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 ...
Majenko's user avatar
  • 106k
2 votes
Accepted

Serial.print and char[] & null

When passing a char* you need to also pass some way of telling the function where it ends. In C that is usually the null terminator and that's all a null terminator is for. If that is missing then you ...
ratchet freak's user avatar
2 votes
Accepted

Serial Monitor is printing out weird values and skipping strings

int checkSum[] = {-1, -1}; const String stringPool[] = { "Satz 1", "Satz 2", "Satz 3", "Satz 4", "Satz 5", "Satz 6", "Satz 7", "Satz 8", ...
DataFiddler's user avatar
  • 1,045
2 votes
Accepted

Need HELP!! Serial communication has a very "Strange Problem"

Why it does not work? You already got the answer in comments: You are reading more bytes from the serial stream than what you know are available. Then, your length variable can contain garbage, which ...
Edgar Bonet's user avatar
  • 44.3k
1 vote

How to read and Serial.print the contents (current values) of an 8-bit register?

Another option: #include <LibPrintf.h> printf("%.8b", ADMUX); //prints: 0110000 The LibPrintf.h library is standard included on ESP boards. %b stands for binary. .8 for 8 decimal ...
Gaai's user avatar
  • 55
1 vote

Printing the array using print and serial write function in Arduino Uno

To store a 2 character string you need a 3 byte array, not a 2 byte array. This is because in C a string consists of the actual string data and a zero ("NULL") byte at the end to indicate ...
Majenko's user avatar
  • 106k
1 vote
Accepted

Arduino Serial.readString() trouble

You need to use Serial.readStringUntil('\n') instead of Serial.readString if you use the Arduino IDE's serial monitor (where a \n is added as termination character when you press enter). Also remove ...
Sim Son's user avatar
  • 1,869
1 vote

Printing vairable with U8GLib

I do not understand, how you initialize the DHT sensor object. (I wonder why this compiles at all.) Your way: //dht11 kodu için ayarlamalar #include <dht.h> dht DHT; #define DHT11_PIN 7 I would ...
Peter Paul Kiefer's user avatar
1 vote
Accepted

Trying to do hello world app for Nokia 5110 LCD with arduino yun and johnny five

Arduino Yun is a ATMega32U4-based board, like other ATMega32U4-based Arduino boards, such as Arduino Leonardo, Micro, the SPI is only available on the ICSP header: MOSI - Yun has it on ICSP Pin 4 ...
hcheung's user avatar
  • 1,549
1 vote

Serial Moniror, '\r' and Realterm

\r returns the cursor to the start of the current line. You can't use it to go back up to previous lines. Instead you need to learn ANSI escape sequences to move the cursor around. For example ...
Majenko's user avatar
  • 106k
1 vote

Displaying characters as bitmaps

I would split it down into functions. First write a function which takes a character and a pair of coordinates, then draws the bitmap corresponding to that character at the given coordinates on the ...
Majenko's user avatar
  • 106k
1 vote
Accepted

How to print/display next menu item with menubackend.h?

You have a global variable menu, which is of type MenuBackend, which contains the structure of your menu system. One of the member functions of MenuBackend is MenuItem getCurrent(), which returns a ...
jose can u c's user avatar
  • 6,974
1 vote

DHT 11 sensors and i2c LCD to Wemos Wifi not Working

Constant D14 is for Wemos D1 and other esp8266 dev boards mapped in arduino core to esp8266 io pin 4. Pin 4 is used as I2C SDA pin. The LCD uses I2C so pin 4 (D14) can't be used for the sensor. from ...
Juraj's user avatar
  • 18.2k
1 vote

U8glib funny problem

Your void_Menu_draw_test_man() function checks menu_redraw_required Does your other part of the program update that variable? Do you call void_Menu_draw_test_man() from the loop() function? It may ...
jose can u c's user avatar
  • 6,974
1 vote

Use Print library to set string variable

You can get all the functionality of Print by creating your own class that inherits from it. For this, you only need to implement the size_t write(uint8_t) method that prints a single character. Here ...
Edgar Bonet's user avatar
  • 44.3k

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