ESP32 Bluetooth command to take a picture

Post here to discuss any new features, components, chips, etc, that you would like to see in Flowcode.
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Bluetooth command to take a picture

Post by stefan.erni »

Hi Martin

Before I compile the Keyboard.fcfx
I would like to ask you in which folder I have to copy the file Keyboard.fcfx.
The program needs an include file "ble_hidd_demo_main.h"
Does this mean that Keyboard.fcfx .. should be copied to the same folder?

regards

Stefan
File it needs
ESP32_2022-11-08_11-26-59.png
ESP32_2022-11-08_11-26-59.png (92.22 KiB) Viewed 1058 times
folder
file_2022-11-08_12-05-33.png
file_2022-11-08_12-05-33.png (26.87 KiB) Viewed 1058 times

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: ESP32 Bluetooth command to take a picture

Post by mnfisher »

Hi Stefan,

The fcfx file in your project folder - attempting to compile this (from within FC) will create a new directory with the name of the project (in this case 'keyboard') contents of the zip file to copy to this new directory.

See my post on esp bluetooth mesh for more detail..

Martin

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: ESP32 Bluetooth command to take a picture

Post by mnfisher »

So - a bit more of a useful setup now.

Handles ASCII characters (7 bit) with the exception of '@' and '£' - I had an American keyboard list - the demo now 'types' a list of character codes and the 'key equivalent. The missing keys should be easily added (2 bytes :-) in the lookup table)
..
65 A
66 B
67 C
..
97 a
98 b
..
So now SendStr accepts strings such as "Hello World\tTabbed+content\r"

Each key is now 'pressed' for 10ms and then released. I suspect faster rates are possible.

As an aside the ascii to keycode routine will work with any HID setup and is very compact - changing the lookup table from an array to a lookup table would save valuable RAM (128 bytes) on smaller MCUs too.
Keyboard.fcfx
(11.48 KiB) Downloaded 61 times
copy to projectdir main .zip
(3.61 KiB) Downloaded 47 times
FCs - compile to hex works but need to upload using idf.py. Compile to C doesn't seem to regenerate esp-project.c?

Martin
Next to have a play with mouse commands?

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 Bluetooth command to take a picture

Post by stefan.erni »

Hi Martin

Compile to C is working and give a keyboard.c

Firts time Compile to hex give a error but it creat the main folder.

So I copy the zip files in the main folder and

Second time Compile to hex run bether.

but still a little error
error.txt
(1.91 KiB) Downloaded 50 times

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: ESP32 Bluetooth command to take a picture

Post by mnfisher »

Hi Stefan,

You need to create the project file as per first downloads then update as per second.

1) save Keyboard.fcfx somewhere (say C:\Projects) open in FC and compile to hex (this will fail - no matter it creates the directories needed)
2) copy in the contents of the first zip (to c:\projects\keyboard)- and then contents of 2nd zip file to the directory (c:\projects\keyboard\main)
3) should now be able to compile to hex in fc.
4) upload using idf.py -p COM5 flash (change 5 as required for your com port)

If you pm an email address I'll send a 'complete' setup - it was too large to upload here even as a zip.

The errors indicate that the CMakeLists file isn't updated - see https://flowcode.co.uk/forums/viewtopic.php?f=3&t=1511 - where I break the steps down a bit more....

Martin

Post Reply