It seems to me your problem lies here:
In this mode, all the synchronous peripherals are turned off, including
your timer. However, you need this timer for generating the input
capture interrupt. You also want it to be running in order to count the
overflows, otherwise the values captured would be meaningless.
In order ...
I am not sure I have the answer to your problem, just a collection of
observations that hopefully steer you in the right direction.
According to your nopaste link, when you send "ON", the first four
keyboard events received by xev are: press(Shift_L), press(O),
release(Shift_L), release(o). One may notice that there is no point in
releasing the ...
The USB keyboard protocol has no concept of characters. It doesn't know and doesn't care what character a key represents. Instead each code represents the location of the key on the keyboard, and it's down to the software on the computer to map those locations into characters through its own keyboard map.
So the Arduino has to do the opposite when you want ...
HID is a strange beast to get your head around.
It operates by way of "Report Descriptors". These are "maps" that lay out what the values you send mean. It's these descriptors that make a keyboard a keyboard and a mouse a mouse.
When you use Keyboard.h you attach a Keyboard report descriptor to the USB HID endpoint, and the computer knows ...
1 ns is a billionth of a second. A 1 gHz clock has a cycle time of 1 ns. If you have a timer that's able to count single clock pulses you'd need a 1 gHz clock to get to 1 ns resolution. for 10 ns, you'd need a 100 mHz clock.
You won't get close to 10 ns resolution with an 8 mHz clocked device.
There is nothing you can do on the AVR processors that I know of, which can run on from a quite slow clock, and I think up to 24 MHz. Since your Uno / Leonardo / Micro run at 16 MHz that would be only an incremental speed improvement (to clock them at 24 MHz).
Your idea of bit-banging is interesting, but in general bit-banging is a last resort when you need ...
Do I really have to set these during that part of the code?
No, you don't. I would, however, change the order of the last
Update TIFR1 right before TIMSK1 in order to avoid an interrupt to
be triggered immediately.
Set TCCR1B last in order for the timer to start only when it has
been fully configured.
Also do I need to reset or delete ...
For completeness I am posting this answer. You can produce a UK backslash keystroke event by using something like
#define KEY_BSLASH 0xEC
This was found rather more empirically than analytically so is not an especially informative result, but it might be of some use to others creating non-ANSI keyboard layouts using Arduinos.
Welcome to ASE.
Communication between the PC and the Arduino Pro Micro happens through the USB, unlike the Arduino Uno and Mega, which use the RX and TX lines.
In your case, the USB pins of the Micro are used to communicate with the PC. Hence, the RX and TX pins are available for digital input and output operations.
Using TX and RX on a 32U4 does not affect PC communication. It uses a competent different communication channel.
You can use those pins for digital operation with no problems, you just won't be able to use Serial1 for communication with serial peripherals.
Buttons are just buttons. You can have them "active high" with pulldown resistors as you have there (10K is fine. The actual value doesn't really matter, just don't have it too low or excess current will be drawn), or "active low" without resistors and connecting to ground when pushed instead of VCC and use INPUT_PULLUP. The choice is ...
This isn't the exact answer but it helps.
Uploading without avrdude is complicated and generally slow. The best solution to not using the IDE is to open and close a port then use the avrdude command that the ide usually uses.
from serial import Serial
from time import sleep
from subprocess import run
while input('Press enter to upload ') == '':
Probably you have overwritten your Bootloader.
Connect MOSI, MISO, SCK and RESET to an ISP-Programmer and flash the file
There are lots of tutorials on the net how to use a spare arduino as an ISP-Programmer.
In your particular case, the double quote is to be entered (using the Spanish keyboard layout) by Shift + the physical key labelled 2. On a US keyboard, Shift + the physical key labelled 2 is "@".
Thus, this simply will get the desired result (the Arduino library assumes a US keyboard layout):
Keyboard.print("echo @This is a demo@");
More general solution