The program on the laptop has the sequence of telling the ESP32 to forward a frame, wait till it is finished, take a picture with the microscope and repeat. The program can also forward the letters for the commands (AaBbCcDdEeFfGgWwXxYyZz) to the ESP32.
The program has therefore two modi: by pressing 1 it is in the forward mode and every letter that is pressed is sent to the ESP32 and the communication back is shown. By pressing 2 the digitizing sequence is started. Note: if you have changed the speed or acceleration, it will keep the change. Also when the program is restarted, the ESP32 cannot know and still will not reset the speed or acceleration. Only resetting the ESP32 module will revert to the standard settings. By pressing 3 the image counter of the digitizer will be set to zero. This can be pressed during both modi. So if the digitizing is in progress and 3 is pressed, the images start at zero again, overwriting the previous scanned images.
I am running the program on Linux Mint in a virtual box on the PC. We can forward the USB port to the virtual machine.
For some reason the program needs super user access to be able to communicate with the serial port. So it should be started with the sudo command.
For some other unknown reason, one in the 100 to 200 images scanned with fswebcam are black and the file size is small. Therefore I used a batch file to scan with fswebcam. After the image is scanned it will look at the file size of the image. If it is small (smaller than 40 kB) it will rescan. If one want to be really sure, one could even check the result of this scan (or even in a loop with a maximum) but chances are really low that a second scan will be black. Maybe you are thinking: what if the frame is black? We also scan the hole (we will see later why) and that is bright white.
The source files (the C++ file control.cpp and the bash file read_pict) are uploaded. Be aware: we should use the g++ compiler.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.