I want to connect USB keyboard to ESP32 and use MicroPyhon repl with that display and keyboard.
How can USB keyboard be connected to ESP32 module and utilized?

True.chegewara wrote:Because you can't connect USB keyboard that doesn't mean you can't use keyboard at all.
I thought about that, and using its "#" key as "E" and "*" key as "F" I could enter one ASCII character for ESP32 MicroPython console with two key presses hexadecimally. But that keyboard input is cumbersome.You can use 4x4 matrix keypad
That sounds interesting. But my searches showed that ble keyboard support for ESP32 is in development and not ready. Do you have link showing working ble keyboard solution for ESP32?or even ble keyboard.
Code: Select all
...
>>> import sys
>>> sys.implementation
(name='micropython', version=(1, 9, 4))
>>> 5**4**3
542101086242752217003726400434970855712890625
>>>
Code: Select all
void setup() {
int a,b,c;
Serial1.begin(115200);
for(a=2; a<=5; ++a)
for(b=2; b<=4; ++b)
for(c=2; c<=3; ++c) {
Serial1.print(a);
Serial1.print("**");
Serial1.print(b);
Serial1.print("**");
Serial1.println(c);
}
delay(1000);
}
void loop() {
}
Code: Select all
...
import machine, ssd1306, os
i2c = machine.I2C(scl=machine.Pin(4), sda=machine.Pin(5))
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
from fbconsole import FBConsole
scr = FBConsole(oled)
os.dupterm(scr)
Code: Select all
#include <KeyboardController.h>
USBHost usb;
KeyboardController keyboard(usb);
void keyPressed() {
int mod = keyboard.getModifiers();
char ch = keyboard.getKey();
if (ch == 0x13) { // Return
ch = 0x0D;
}
if (mod & (LeftCtrl|RightCtrl)) {
ch &= 0x1F;
}
Serial1.write(ch);
}
void keyReleased() {
}
void setup() {
Serial1.begin(115200);
delay(200);
}
void loop() {
usb.Task();
}
Users browsing this forum: Baidu [Spider] and 32 guests