Blocktinu is a web-based development environment for microcontrollers that works with blocks in a browser.
Tinusaur boards now have an OLED display with 128 x 64 pixels resolution that uses the fastest microcontroller driver.
A few days ago, we completed the integration between the Tinusaur boards; OLED display SSD1306; the fastest driver – SSD1306xLED; and Blocktinu.
Only a few basic functions are implemented at the moment: clear and fill the screen; output text; outputting numbers. We will add more over time.
Here are some demos and examples of using these features.
Demo for the functions
Let’s start with the four basic features currently available:
- Clear and fill the screen;
- Output text;
- Outputting numbers.
The program is not complicated but rather shows how easy it is to use the functions for working with an OLED display.
The display is not of high resolution but sufficient to display useful information.
Display data from sensors
The next step is to read data from some sensor and display it on the screen. In the example below, these are:
- The value of the built-in temperature sensor;
- The value of one of the analog inputs.
As you already know, you can always sneak into the C code Blocktinu has generated for you, to understand better how the program actually works.
The built-in temperature sensor is not very precise, but it can give us a more or less good idea of our environment.
The value it gives us is not in degrees C or F but a number from 0 to 1023, which we can approximate to degrees if necessary.
IMPORTANT: the temperature sensor is built into the microcontroller and is designed to measure the chip temperature. Under normal conditions, it will be very close to the ambient. This might change if we overload the microcontroller and it overheats, for example, or if it is exposed to direct sunlight.
An external sensor can be used for more precise temperature measurements. We will write how this is done in one of our next articles.
Analog input data
Reading data from an unconnected analog input is an interesting experiment. The data we receive will constantly change because the input is “floating” and has no fixed value.
If we touch it with a finger, we will see that these values change, but again they vary widely.
Using the Scheduler
Some time ago, we wrote about a new feature for Bloktinu – the Scheduler. It allows the implementation of (almost) parallel tasks on the microcontroller.
In the particular example, the second task increments the value of the variable every 1 second, and the main program displays it on the screen.
We have to keep in mind that in practice, when the execution of the second task in the Scheduler starts, the main program stops its execution. When the code in the Scheduler finishes executing, the execution of the main program continues. This is because we only have one microprocessor, and it cannot perform more than one operation at the same time. This concept of running more than one task is called time-sharing because the tasks share the CPU time.
We plan to add support for the DHT-11 humidity and air temperature sensor very soon.
If you have interesting suggestions and recommendations – write to us.
Soon we will show you how to write programs for this OLED display directly in the C language to achieve much more. Check the example below in the video.