New answers tagged

2

The purpose of the PSTR() macro is to configure the string to be used directly from flash memory. The string is then not loaded to dynamic memory at runtime as it would be without PROGMEM specifier set by the macro. The purpose of the FPSTR() macro is to cast a string to 'dummy' FlashStringHelper type to help compiler choose the right overloaded function if ...


1

I don't know if I understand your question well, but if what you want to do is reset MCU programmatically, watchdog is good solution. The orther way is connect IO port and reset port by using wire, and send a signal(send LOW or HIGH voltage to reset port) to reset port. Or use asm code.


2

The best way to handle this exception is to identify what's using so much space on the stack and rewrite your code to avoid it. The three most common ways you'd use too much stack space are: large local variables - for instance, declaring a large array as a local variable inside a function, like: #define VERY_LARGE_STRING_LENGTH 8000 void loop() { char ...


2

For starters: this bit is a strange mixture of for and while syntax: while (int i = previous_angle) { i <= 90; i = i + 1; myservo.write(i); delay(45); }; It will compile, but probably not do what you want it to do. It should probably be: for (int i=previous_angle; i<=90; i=i+1) { myservo.write(i); delay(45); } Also, previous_angle ...


3

This looks like a rounding problem. If the number you want to print lies within the open interval (9.95, 10), the condition value < 10 is true, as the number is strictly less than 10. Obviously, value != 10 is also true. Yet, lcd.print(x, 1) will round the number to the closest multiple of 0.1, which in this case is 10. I see no better solution than ...


1

This is a partial answer. I assume you already know how to build a Web server on you ESP32, and how to react to client requests. If not, there are tutorials available on the Internet. Here I will specifically discuss the issue of the hyperlink. You wrote: <a href="trigger">Click Here To Trigger The Rick Roll!/a> Not only the closing tag ...


3

You can't. Variables and macros are completely different concepts and handled by completely different parts of the compiler toolchain. Instead you will need to build your string up into a char array (or whatever format the _user_gcode_exec() function accepts) with the likes of sprintf.


1

You have: digitalWrite = (redLED, HIGH); This is incorrect since digitalWrite is a function not a variable. Instead you likely want: digitalWrite(redLED, HIGH); This calls the digitalWrite function with the two arguments.


1

The "init failed" do not appear. Everything stops at "//******". I have compared to another RFM69 program. I have added a line " digitalWrite(RFM69_RST, LOW);" at the begining of the "//manual reset" and it works now. the sequence digitalWrite(RFM69_RST, LOW); digitalWrite(RFM69_RST, HIGH); delay(10); digitalWrite(...


0

You sound very much the same as me when I got this screen, it took me a while, There is one of 'Dronebot's sessions on Youtube where he is connecting this screen which may get you started. I got drivers and information on lcdwiki.com with examples in the library folder. I believe you get either a Uno to Mega version of this screen as the pinout is different ...


1

There is an open issue with the Stino Arduino plugin for Sublime Text which means that structs are not handled properly. Thank you to Jura and Edgar Bonet for helping me to answer this question.


0

After some googling I came up with this solution. I really hope someone finds a more elegant way to express it. These embedded ternary operators are really error prone. #define IV(i) ( \ (i)=='┌' ? 0xc9 : \ (i)=='⎩' ? 0x15 : \ (i)=='⎭' ? 0x17 : \ (i)=='⎰' ? 0x18 : \ (i)=='°' ? 0xb2 : \ (i)=='™' ? 0xd0 : \ (i)=='Ξ' ? 0xd8 : \ (i) ) char line2[21] = {0x15, '_'...


1

#define IV('┌') 0xC9 That really isn't how macros work. What goes in the brackets is a named parameter that is then used in the body of the macro. You can't have multiple macros named the same like that. The simplest thing to do is just make a set of macros named after what the character is. For example: #define CHR_DEGREE 0xc9 #define CHR_BOX_TL 0xB2 ...


1

I would avoid having multiple .ino files, because of the issues raised in the other answers. If you want to split your code into multiple files, the scheme that works reliably is to have: a single .ino file, named like the containing folder, holding the “main” program (this is Arduino-specific) a pair of .h/.cpp files for each “module” implementing a sub-...


3

The global constructors run right after the initializations performed by the C runtime startup code, and right before main() gets called. In a nutshell, the C runtime initialization code: does some low-level initializations (e.g., setup the memory) calls the global constructors calls main(), which in turn calls init() to do the Arduino-specific ...


0

class LED { private: const byte _pin; public: LED(const byte pin); }; With an even simpler c'tor: LED::LED(const byte pin) : _pin(pin) {}; To be a bit on-topic: The initializer list is even executed before the constructor body, and is thus the way to initialize constants. Question remains whether it's guaranteed that this works: class LED { private: ...


0

It is executed before the main() is called (in the main() there is setup() called and then loop() is called in infinite loop). It has its own sections for the constructors and destructors: http://beefchunk.com/documentation/sys-programming/binary_formats/elf/elf_from_the_programmers_perspective/node4.html


-1

Try to add struct at the first of function, such as: struct EulerAngles anglesCalc(){ EulerAngles a; // calculate a return a; }


Top 50 recent answers are included