New answers tagged

1

This is NOT my answer, this is the answer of @Gerben, thank you. The Arduino IDE suspends the serial connection while uploading, and then resumes when done. It looks like they added some delay before reopening the serial connection. So it looks like you code will run twice, even when you keep the Serial Console open


-1

I'd like to proposes a couple of changes to @VE7JRO's implementation. For C++, it is perfectly normal to initialise an Class instance via its construct, however, for Arduino, the setup() get call in Arduino main() after some initialisation of the hardware, including pin definition, etc., it is why Arduino advocates in Arduino Style Guide for Writing ...


0

Acknowledging that it is not exactly the answer to your question, the folks at Adafruit have written an excellent tutorial on breadboarding the raw L293D chip. Which may be a more compact option for you? Your question asks how to attach an L293D shield to a breadboard, and as @Juraj said in the comments, you can't do this easily directly. As @Jsotola ...


0

Thanks to @chrisl, here is the answer: The NewPing library uses Timer2 on UNO, which means pin 3 (and 11) is not available for use. I have been using pin 3 for interrupts from a rotary encoder, which is probably the reason for the sluggish performance. The bad news are there are only two interrupt pins on UNO - 2 and 3, so if I want to attach two rotary ...


0

It probably needs a library. Looks like you have some kind of AFDC library and did not use it.


1

I suspect (based on your description) that you've got the sensor wired up wrong. You need to include a resistor (aka RL) to convert the change in resistance of the gas sensor to a voltage (in addition to separately powering the heater). See the attached circuit from the datasheet. You could use a fixed resistor of ~20k in place of RL and see how that works ...


1

The X-axis is fixed and nothing gets plotted on the X-axis. It has its own divisions and they are automatically set by the Arduino IDE. The Arduino IDE still has to do some improvements to its software so that the X- axis can be adjusted and plotted too! This is my experience so far and corrections are welcome!


0

try this : $ apt search avr ... gcc-avr/focal 1:5.4.0+Atmel3.6.1-2build1 amd64 GNU C compiler (cross compiler for avr) ... $ apt search atmel ... simulavr/focal 1.0.0+git20160221.e53413b-2build1 amd64 Atmel AVR simulator uisp/focal 20050207-4.3ubuntu1 amd64 Micro In-System Programmer for Atmel's AVR MCUs ... hints here : https://stackoverflow.com/...


1

https://mil.ufl.edu/374/docs/Install_Atmel_Studio_7.0.pdf : Note for Mac and Linux Computer Users If you have a Mac (i.e., a Macintosh computer from Apple) or if you use Linux, you will need an alternate Windows installation or you will need to install a Windows virtual machine in order to then install and run Atmel Studio. We suggest that you install Boot ...


2

You may be able to do it, or you may not. It depends on the switch. There are two classes of slide switch: Make-before-break Break-before-make In the former the contact you are sliding to is connected before the one you are sliding away from is disconnected. This can cause untold problems as you will basically create a short circuit between 5V and GND. ...


1

Edit as follows: Serial.begin(115200); Serial.setTimeout(10); //Maximum time in ms that it should wait for data The default delay is 1000ms. The code above sets it to 10ms. Play around with the Timeout value and check for faults. https://www.arduino.cc/reference/en/language/functions/communication/serial/settimeout/


0

I don't know this is your problem, but it is a problem in any case. The pointer itself, not just what it points to, would also need to be volatile qualified. That is: volatile uint8_t *volatile current_port = &PORTB; volatile uint8_t *volatile next_port = &PORTB; The volatile after the pointer declarator (the *) determines the volatile quality ...


1

The problem is most likely your power supply coupled with the poor design of the capacitive sensing system. The capacitive sensing is done by measuring the capacitance between your foil plate and "ground". That "ground" is usually a connection through the USB cable and your computer's power supply through the earth wire of your power ...


2

If we ignore the capacitance of the input pin, then it would instantly follow the voltage of the send pin. A voltage drop over the resistor only happens if a current is flowing though it, which cannot happen without any capacitance the receive side. Without current a resistor is just a wire. A floating pin doesn't directly have its state randomly changes ...


5

The program most likely hangs at Wire.endTransmission();, because that's where the actual I2C communication happens. Wire.write() does nothing but placing the data into the internal buffer of the Wire library. You experience problems because you are calling interrupt-dependent code inside an ISR, where interrupts are deactivated by default. The Wire library ...


0

I hate to bring this up, but I've now been programming for 58 years. One curious and often overlooked feature of the C & C++ languages is the GOTO keyword. It can be very useful. My second language was FORTRAN I. I know, now I'm relegated to the 9th circle of he|| where the miscreants are frozen into glaciers head down with their legs protruding?


-1

To flush the Arduino Serial input buffer, use <Serial.listen();>


0

Using String.getBytes(buffer, len) to get bytes. "len" is the length to copy, but usually need to add 1 for the end of string '\0'. For example: String s = "123"; int count = s.length(); // lenth() is 3 s.getBytes(buffer, count); // copied "12\0" => HEX(31 32 00) s.getBytes(buffer, count + 1); // copied "123\0" ...


0

(Assembling an answer from the comments) The consensus is that there is no "simple way to emulate the original gameboy cpu using Arduino". That a more powerful platform is required. Multiple commenters expressed difficulty with the novel concept of "hexadecimal/pixel based logic". It is suggested that this concept may be without merit.


1

If you only need two PWM pins, I suggest using hardware PWM with Timer 1. The Timer 1 library makes the process quite easy. It supports frequencies from 0.12 Hz up to a few MHz, although the resolution degrades above 7.8 kHz. Compared to an interrupt-based solution, hardware PWM has less jitter and it does not consume CPU cycles. The drawback is that you ...


0

You can try to use my AVR_Slow_PWM Library, which can provide these following features and generate 2 independent PWM signals to any GPIO pin. Certainly only if your hardware design can correctly use PWM signals. This library enables you to use ISR-based PWM channels on AVR-based boards, such as Mega-2560, UNO,Nano, Leonardo, etc., using AVR core to create ...


5

It's not the unsigned long that's overflowing but the calculation that you're assigning to it. 3600 is a signed integer (by default), and now.hour() is an unsigned byte. The unsigned byte gets promoted to match the "largest" type in the calculation - a signed integer - and then the calculation is performed, resulting in a signed integer. That ...


Top 50 recent answers are included