11
votes
How can I stop digital pins from floating at reboot?
You could in principle set the pin state a little bit earlier, by
plugging your code into the C runtime's initialization sequence. This,
however, will only buy you a few microseconds: the pins will ...
6
votes
Press the Windows key using "keyboard.press();"
They Keyboard.press() command accept modifiers per the documentation. You may need to do multiple press() commands before releasing.
For example, if you want to launch File Explorer you could use:
...
6
votes
Accepted
How do I prevent Arduino from running on startup?
The Leonardo should wait a couple of seconds after resetting to see if a new sketch arrives.
Power off the board completely (remove the USB cable).
Hold down the Reset button, and keep it held down (...
6
votes
Accepted
Where in datasheet is the warning about unreliability of reading PINxn?
did somebody come across such case, or I'm the first in the world?
You are not the first. I recently got bitten by the very same issue.
However, unless you are close to an unusually strong radio ...
6
votes
Accepted
How can I detect which baudrate a virtual COM port is set to?
From looking at the source it appears that on 32u4 based boards Serial includes extra methods to access the settings from the USB host:
see: https://github.com/arduino/ArduinoCore-avr/blob/...
5
votes
Upload code on Arduino Leonardo using command line
After try some trial and error I have built a simple binary to upload into the Leonardo bootloader. This binary opens serial at 1200 baud then closes it, and wraps the avrdude binary to write .hex ...
5
votes
How to convert Arduino example sketch to a complete c++ project?
Basically *.ino is *.cpp without headers. So you can
rename it to *.cpp,
If you have any functions which are used before they have been defined, provide declarations for each function before its ...
5
votes
Accepted
Which Arduinos have a true serial port?
There seems to be quite a few Arduinos without a 32U4, like:
Uno (you mentioned it already)
Mega (same)
Lilypad Snap
MKR1000
Pro
Pro Mini
Zero
Due
Ethernet
Mini
Nano
MKR Zero
See the list at ...
5
votes
Accepted
Arduino Leonardo(Atmega32u4) - Detecting if USB is connected to a computer?
ADDEN of UDADDR is set if the '32U4 has been assigned a USB address by the host and the firmware wants to enable USB connectivity.
UDADDR & _BV(ADDEN)
5
votes
Accepted
Help with AlphaNumeric array
All of those "A1" "A2" pins have other numbers that go with them. The A1 or A2 is #defined in the core to be some number. You can just use A1 or A2 and it will work.
For example, try this line and ...
5
votes
Generated frequency is not as expected
digitalWrite() takes a few microseconds to execute as well. There is also some overhead around the delayMicroseconds() function.
If you need exactly 500 kHz, you would want to consider using a timer.
...
4
votes
Accepted
Can Arduino Leonardo use USB port and RX TX serial pins at the same time?
32u4 is multi-serial uC. USB connection works on default serial communication which can be used via Serial.print("somevalue"). On the other hand if you want to use RX/TX on pins 0, 1 which are ...
4
votes
Arduino I2C Wire.onReceive hangs after a few loops
After a bit of tinkering, I noticed that removing the delay() call in the slave fixed it and there were no more hangs. Also, when using the Servo library to move a servo instead of blinking the led, ...
4
votes
Accepted
Arduino Leonardo/Pro Micro sleep and USB
The Arduino has several sleep modes. They differ mainly by the clocks
that are kept running, the peripherals that are enabled, and the
possible wake-up sources. All these modes are described in the
...
3
votes
Accepted
why leonardo bootloader is bigger than UNO?
Apparently leonardo and UNO are very similar boards.
No, they are very, very different.
The Uno uses an external USB-UART bridge. This means that the bootloader code only has to read from the UART ...
3
votes
Send Keyboard Media Keys with Keyboard Library
It is indeed possible and also without the requirement to modify the Arduino environment itself. Just register an HID descriptor for the "report ID" for "Consumer Control" (the ...
3
votes
Accepted
Arduino Leonardo - Using ICSP pins for serial
From packages/arduino/hardware/avr/1.6.*/variants/leonardo/pins_arduino.h:
// Map SPI port to 'new' pins D14..D17
#define PIN_SPI_SS (17)
#define PIN_SPI_MOSI (16)
#define PIN_SPI_MISO (14)
#...
3
votes
Arduino analog input protection
If you amplified with an op-amp powered by 5V then it couldn't produce more than 5V output, so that could be your solution. Failing that, I think a resistor and a couple of clamping diodes would help. ...
3
votes
Accepted
Getting a fixed sampling rate
You can speed your code up slightly by sending a raw microseconds reading, rather than divided by 1000000. Floating arithmetic on typical Arduino devices can be quite slow. Also, the time to ...
3
votes
Library to set internal analog gain of the Arduino?
I would recommend you to check Nick Gammon's example on using the analog comparator by means of configuring the relevant flag bits of registers in the ATmega328. Sample code from the link, by Nick:
...
3
votes
Pressing reset button restarts program only seconds latter
The first thing that happens when you apply power to a board or press reset, is the bootloader executes. That waits for a short time to accept a new sketch over the serial port. If nothing arrives it ...
3
votes
Multiple SPI device
Some card reaaders (as well as display boards with built-in sd socket) use 10-kOhm resistors in series to the CS, DIN and CLK lines, to perform a cheap 5V to 3.3V level translation. This is really not ...
3
votes
Accepted
Arduino Leonardo RX TX mystery
An Arduino Leonardo has native USB support. Which means that it has separate serial interfaces to the PC and to the hardware pins.
Serial is only used for the communication with the PC and is ...
3
votes
Accepted
Failed to initialise SD card on Leonardo
A Leonardo has the SPI pins on the ICSP header, not on pins 11, 12, 13.
And a Pro Micro has the SPI pins on 14, 15, 16.
3
votes
Where in datasheet is the warning about unreliability of reading PINxn?
A test with an Arduino Uno.
I used the usb connector to power-on the arduino uno. The led is at PB5, so I have exchanged PB0 and PB5. My test is therefor not the same.
#define LED_PB PB5 // pin ...
3
votes
Multiple Time-Sensitive Tasks
Two possible solutions:
Split the serial string in small pieces so it's (comfortably) less than 50 ms and send the string in 'pieces' … you could even send it until e.g. 45 ms has been reached and ...
3
votes
Accepted
Why can the Xbox360 not detect the Arduino Leonardo as keyboard?
Like Juraj and Majenko said. Arduino Keyboard library does emulate "Boot Keyboard".
I use NicoHood HID library and now it works.
3
votes
Arduino sketch uses too much memory storage space?
There is no problem here, please read the message carefully!
It says you are ONLY using 30% of the available program memory and 19% of the dynamic memory.
You have a LOT more room left.
3
votes
Accepted
LiquidCrystal issue with HD44780 display
The error is, that V0 has VDD level by the way you connected the resistors. The "lower end" of your ladder needs to be at GND, pin 1.
The pin 15 (A) is the anode of the backlight, and is not ...
3
votes
Accepted
Can't type backslash (\) with Keyboard library
You have to keep in mind that the Arduino doesn't send characters to the
computer. Instead, it simulates key presses, and the computer has to
translate those into characters, according to some ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
arduino-leonardo × 331serial × 41
usb × 35
arduino-uno × 32
atmega32u4 × 30
arduino-ide × 25
arduino-pro-micro × 24
keyboard × 21
bootloader × 17
uploading × 15
programming × 14
bluetooth × 13
c++ × 11
power × 11
arduino-micro × 10
avrdude × 9
arduino-mega × 8
motor × 8
led × 7
i2c × 7
timers × 7
library × 6
pwm × 6
softwareserial × 6
analogread × 6