Showing posts from November, 2010

Moving code from ESP8266 to ESP32

A while ago I made a mashup of Dan Royer's code CNC 2 Axis Demo with my own code for trapezoidal motion stepper and servo control for ESP8266.

I assumed porting the code to the ESP32 would be trivial, and that was true for the most part: changes like library name being Wifi.h instead of Wifi8266.h were not a problem. UDP now does not like multicharacter writes but you can use print instead. So far so good.

However, when it came to the interrupt code I was stuck with the stepper interrupt causing an exception sometimes. And to make things weirder, the servo interrupt worked flawlessly (both of them had the IRAM_ATTR directive if you ask me).

Going little by little, I could narrow down the culprit to a floating point operation during the interrupt, that would cause problems sometimes but not always. Browsing around I found this post. Where the solution was simple: do not use floats within the interrupt routines but doubles. The reason was the float calculation would be performed by…

OpenCV with Processing

A recent art project requires to do some image processing. This topic is a bit away of what I use to do so I asked around what was available now. Some people suggested me to use OpenCV, which is an open library for Computer Vision projects.

I realized that Processing also had some basic features for real-time image capture. Even better, I learned that there was a version of OpenCV available for Processing.
The reason of using OpenCV from Processing instead of directly programming in C++ is the easy setup you have with processing. If you have a PC or Mac the use of the system webcam is very easy. For Linux systems it is slightly more complicated.
OpenCV makes very easy to do thinks like detecting faces on the image, which is quite funny. There is this book about OpenCV too.

Dropbox experience

Once I realized I needed to sync my iPad to pass every tiny file to it though iTunes I was not happy. So when I learned there was a Dropbox version for it that was free I saw an opportunity. Later, I found out that there were dropbox versions available for Linux, OSX and, of course, for Windows.
A bit later, I learned that even there is an app for my trusty Nokia E71 so I can upload picture to a dropbox folder right away.
Since then I've almost stopped using a USB pendrive in favor of dropbox and till now, the server has been great.
In a nutshell dropbox is a shared folder on the web plus an app on each computer that syncs the content of your local folder with the copy held on the Internet. Any file you add or change is modified on the network storage. To put the icing on the cake there is also a web-based access to your data, so if you're visiting a friend or using a lab computer you cannot install software on, you still can access your dropbox account files.
Basic service is fr…

Java and Javastript playing together

One of the features that came with Java 6 is this neat trick: You can have a Javascript runtime on your Java program. You feed it with Javascript code and you can get the value of the variables.

It looks great if you need to use some logic already encoded with Javascript and you need to include it in your Java program. No rewriting is needed then.

I've done a sample program to evalaute a simple arithmetic expression as the first command line parameter of this Java program.