Updated: Feb 26
In this tutorial, we are going to see how to use serial and Bluetooth.
In the first example, we will increment one number variable and print it on a serial monitor.
In the second example, we are going to receive a character from serial or Bluetooth and turn on different LEDs according to the letter received on the serial or Bluetooth
blocks We are going to use
You can find serial/Bluetooth related blocks in the 'Serial' category as shown in the following image
If a Bluetooth module is attached and something is printed on a serial, that will be sent to serial and Bluetooth. But character can be received via Bluetooth and not via serial monitor because
if bluetooth module is attached, then bluetooth will have higher priority than the serial monitor for receiveing the character
1. Serial print
In this block, we can input a text which will be printed on serial
2. Serial print number
In this block, we can input a number that will be printed on serial. This number can be integer or real.
3. read character on serial/Bluetooth
These both the blocks are the same and can be used interchangeably. This block is used to get serial/Bluetooth received character in a variable
This block is used to input a single character.
In this example, we will increment one number variable and print it on a serial monitor.
To open the serial monitor, click on the serial monitor icon in Nirmiti IDE. The serial monitor button is pointed using the red arrow in the following image. select the com port and baud rate equal to 9600 and press 'connect'
To receive data on mobile via Bluetooth, connect the Bluetooth module as shown in the image below
Use the 'Serial Bluetooth Monitor' app for connecting mobile with Nirmiti wirelessly via Bluetooth.
In this example, we are going to receive a character from serial or Bluetooth and turn on different LEDs according to the letter received on the serial or Bluetooth.
In the following blocks, we turn ON the green LED if character 'O' is received and turn OFF if character 'F' is received
To send the character to the Nirmiti board using Serial monitor, write it in the transmitter field as shown in the following image and press the 'send button
For sending the character to the Nirmiti board using the Serial Bluetooth monitor app, write it in the transmitter field as shown in the following image and press the 'send button