New answers tagged

0

There is no "left" or "right" in a binary number, only in the human representation of that number. It is traditional for us to place the most significant bit on the left, purely because that his how we represent other numbers - like 1234 (1 is the most significant digit, the thousands). Given the pseudo-number 12345678 if you shift out LSBFIRST the 8 gets ...


0

Integer values of the Arduino have the MSB left and the LSB right. The shiftOut() function let's you choose, how the order should be timewise. If you provide LSBFIRST, the function will start the transmit with the LSB (on the right) and then go left to the MSB. Otherwise it will start with the MSB and then go right to the LSB. So this effects only the time ...


-1

When you install your Arduino, 3 locations are used for your libraries: Installation folder Personal folder Boards folder Installation folder This is the location where you installed Arduino. Normally they are: On Windows: %ProgramFilesDir%\Arduino\libraries On Linux: /home/{USERNAME}/arduino-{VER}/libraries There, you can find 5-10 base libraries. ...


0

You can assign the pointer to NULL, and in the setup function give it a value. Note you have to add () for the arguments, even if there are none like in this case. Also you have to include the library (but probably you did but not added in your question). #include "Adafruit_NeoPixel.h" Adafruit_NeoPixel* pixels = NULL; void setup() { pixels = new ...


0

Your code will only do anything if a client has connected to it because of this line if (!client) { return; } Your physical button will never do anything on their own unless a client has connected and has sent some data. For the random direction you use a line like the following to randomly pick a direction int direction = random(0,2) ? 1 : 0 ; ...


0

Arduino creators toughed of you. Personally I use Geany, but you can use eclipse, but I find the Arduino plugin rather hostile, especially when it comes to editing default libraries (to add printf) and pointlessly complex serial monitor settings default above the NANO's range. Although its missing testing feature without upload Although most other editors ...


1

I use the Arduino IDE to 'build' everything. However, in case of a bigger project, I use a 'decent' code editor (Visual Studio in my case) to edit, and the Arduino IDE to build. Also, because I prefer testing all non-Arduino related code on the PC (not on the Arduino), the Visual Studio (C++) project uses some stub classes I created (specifically for my ...


2

(Answering in more detail, as this is the top search hit for "ESP8266 Vin", at least for me) TL;DR: Vin is NOT directly connected to USB power. There is a protection diode between USB+/VU and Vin, which has a limited current capacity. If your board provides VU, that one is directly connected to USB power. As long as you only power 1-2 tiny devices, it ...


2

The simple answer is "libraries". Every time you start the application, all files inside your library folder are parsed. And this is not done over your OS, but over the Java-Virtual Machine. So it is not just slow, it is ultra-slow! Since your antivirus will probably also check each file. Once, all files was read (maybe 1/2 of the time spent by your ...


0

Definitely related to poor antenna matching. This is complex stuff and should preferably be fixed by changing antenna matching (e.g. by a matching circuit or simply trying out a different antenna). I have also seen that it helps to wait until you get the unsolicited modem response "Call Ready". Until you get this message, it can disturb the modem to receive ...


0

Acceleration is a vector quantity. Therefore, instead of looking at the average values of X,Y, and Z, you should probably look at the magnitude of the acceleration vector, that is (X^2+Y^2+Z^2)^0.5. Then, you can set an acceleration threshold below which you would send no data. The benefit of using the magnitude of the acceleration vector is that it is ...


0

Have you made sure to modify the board before using it? This page mentions at least one resistor that you have to replace for the USB to "work". The USB standard requires a 1.5 kΩ pullup resistor on D+, but this board is known to have a wrong value (R10 on the board). It ships with either a 10 kΩ resistor or a 4.7 kΩ resistor, but it should be replaced ...


0

I assume you want to store multiple values in the text file, and then have the Arduino IDE (not the Arduino itself) read the file and insert the data into your sketch. If this is really what your question is about, a quick and dirty solution would be as follows: Format the text file as a list of comma-separated numbers, either in one or several lines. For ...


1

You can use the millis function to check the current 'time'. If you store this, and later call this function again, by subtracting you can see how much time has been passed. so instead of delay(500) you use if (millis() - timeStamp >= 500) { ... to continue your code. As others said in comments, you also need to debounce to prevent multiple button ...


0

Installing the Arduino package from the Debian repository (or the one for derived distros like Ubuntu) performs the useful purpose of setting up all the necessary permissions for the Arduino IDE to work. Those permissions are NOT automatically removed when you uninstall the package. The simplest way to get a working Arduino install: 1. Install Arduino from ...


2

EEPROM on the ESP32 doesn't work like you would expect. It uses the SDK's "Non-Volatile Ram" storage system to store the data within the nvs partition. This works through a system of "Key / Value" pairs, and the data is stored as a "BLOB" (Binary Large OBject) for the key eeprom in the namespace eeprom. Quite what the internal layout of the data within ...


0

C has an "Exclusive Or" operator which is ^. You can use that instead of | so that it toggles the bit rather than always setting it: case 'A' : bt_leds_activated ^= 1; break; With ^ if you OR a 0 with a 1 you get a 1. If you OR a 0 with a 0 you get a 0. If you OR a 1 with a 1 you get a 0. That means every time you send A bit one of ...


0

simply, using strcpy, and using a char with a given length, works RTC_DATA_ATTR char ssid["dedicated length"]; strcpy(ssid, cSsid->getValue().c_str(), "dedicated length");


1

On the ESP8266 flash is a very special case. Because the ESP8266 itself does not have any flash, but instead uses an external SPI-connected flash chip, accessing it is not an easy or technically obvious operation. Reading from the flash chip is slow. Very very slow (by comparison to reading RAM). Because of this where possible certain things are copied ...


0

If your data input rate is higher than, or even close to, your serial output rate (baudRate/10 char/s), your system will be unable to keep up. With an interrupt driven system, make sure your interrupt function executes and returns as quickly as possible, i.e., does as little as needed to not lose data. Let the background process (the main sketch code) deal ...


0

It seems to be a A/B coding : if A gets high before B, it's one way (count for exemple), and if B gets high before A, it's other way (decount). So, connect power and ground. Then connect the two wires to input pins : int P_A=2; int P_B=3; //Inputs long int position = 0; //Position of wheel long int lastPosition = 0; //last position of wheel : ...


Top 50 recent answers are included