New answers tagged

1

Without the full codes, we can only guess. My guess would be the serial receive buffer on the Arduino is overflowing. One reason this could happen is if serialEvent() is not called frequently enough. This function is called by the Arduino core on every loop iteration, just after loop() returns. If your loop() takes too long (e.g. you are using delay() or ...


1

You could do it by using one wire for ground, one wire for nano->mini, and one wire for mini->nano. The nano->mini wire carries both power and data. You can keep it at some voltage above ground to provide the power and superimpose a data signal that is AC coupled off at the mini end. Alternately, you can rectify the data to provide power if you ...


2

I have tested your code. There appears to be defective clones of the nRF24L01 around that exhibit an issue I show in post nRF24L01 continuously reading closed pipe You can work around this issue by changing your code as follows (although your process still has to read all those nulls): void getData() { uint8_t pipeNum; if ( radio.available(&pipeNum) )...


1

An example of protocol using a single wire (besides ground, so a total of 2) for both bi-directional communication AND power: Dallas 1-wire There are few other similar standard protocols and you are free to think about your own as long as you are willing to implement all the internals instead of using a well-written and widely used library.


5

You can have bidirectional communication over a single wire by using open-collector outputs. For this, you could add a circuit like this on each side of the link: simulate this circuit – Schematic created using CircuitLab Here, TX is the transmit pin of the Arduino, and DATA is the data wire. The RX pin is connected directly to the data wire and, ...


3

This question likely suffers from the X Y problem. Where the question (about software) and possible answer (centered on hardware) do not approach the solution using the same methods. The question is essentially asking how to design a 1-wire interface over longer than normal distances. There are 1-wire Arduino libraries and 1-wire Arduino tutorials. But it ...


1

Serial.<anyKindOfOutput> all goes to the terminal. So without knowing more about your application, I can only guess, but you could: Comment out the Serial.write()s. Surround the Serial.write()s with #ifdef SUPPRESS and #endif. Put the Serial.write()s in an if( ) block whose control expression will only be true when you need the Serial.write()s to be ...


1

In the Arduino IDE you should select "No Line Ending" from the menu, instead of "New line". Otherwise you are sending an extra "\n".


3

As regards the use of Stream: I usually use Stream instead of HardwareSerial because: It allows the use of other serial devices, like SoftwareSerial or USBSerial that aren't "Hardware" UARTs. It even allows the use of non-serial systems, like sending data over networks or wireless devices However it means: The user has to manually initialize ...


0

There is no best way, the first is using a global variable, being static. The second is dynamically (or at least to pass a serial instance). It depends on your use If you want your code always to work with the same declared serial (hardware or serial) instance, you can use the first method, as it is the easiest. If you want your serial hardware port to be ...


3

The Sparkfun RS232 shifter is not a great device. It relies on whatever it's connected to (on the 9-pin port) providing the negative rail for the EIA-232 voltage levels. That's fine when you connect to something that has those voltages available, such as a computer, but many "devices" don't - they will themselves have a similar shifter inside and ...


Top 50 recent answers are included