# Examples

GitHub

# Hello World

## {{@264#bkmrk-open-iot-and-iiot-ga}}

Link to repositories:

- [C](https://github.com/Redisage/STM32_Open_IoT_and_IIoT_Gateways_examples/tree/main/Hello_world_example)

This example uses UART4 in the MCU which is reserved for the USB UART communication. A simple string is printed on the console and then the device restarts after 10 seconds of countdown. Use 115200 baudrate.

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-01/scaled-1680-/KCnimage.png)](https://doc.redisage.com/uploads/images/gallery/2025-01/KCnimage.png)

# New Page



# New Page



# LED

## {{@264#bkmrk-open-iot-and-iiot-ga}}


Link to repositories:

- [C](https://github.com/Redisage/STM32_Open_IoT_and_IIoT_Gateways_examples/tree/main/LED_example)

A simple blinking LED example intended for the Open IoT Gateway. Lighting LED will be changed every 1 second from LED1 to LED5.

# Switch

## {{@264#bkmrk-open-iot-and-iiot-ga}}


Link to repositories:

- [C](https://github.com/Redisage/STM32_Open_IoT_and_IIoT_Gateways_examples/tree/main/Button_example)

Simple tactile switch example intended for the Open IoT Gateway. After flash, connect device to a PC and open port in Console Terminal. The information about the switch pressed state will be displayed in the console as shown below.

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-01/scaled-1680-/v4Aimage.png)](https://doc.redisage.com/uploads/images/gallery/2025-01/v4Aimage.png)

# RS232/RS485

## {{@264#bkmrk-open-iot-and-iiot-ga}}


Link to repositories:

- [C](https://github.com/Redisage/STM32_Open_IoT_and_IIoT_Gateways_examples/tree/main/RS_Example)

This script tests internal communication between serial ports with the possible lowest (2400) and highest (115200) baudrate.

For this example, connect each port's transceiver with the receiver:

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-02/scaled-1680-/image.png)](https://doc.redisage.com/uploads/images/gallery/2025-02/image.png)[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-02/scaled-1680-/jkIimage.png)](https://doc.redisage.com/uploads/images/gallery/2025-02/jkIimage.png)

Default settings:

- baud rate: 115200
- data bits: 8
- parity bits: 0
- stop bits: 1
- receiver timeout: 3s

If the connection is right, you should see the messages shown below for each U(S)ART:

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-01/scaled-1680-/sktimage.png)](https://doc.redisage.com/uploads/images/gallery/2025-01/sktimage.png)

If something goes wrong with the connection, you will see the message for a specific port like below:

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-01/scaled-1680-/c10image.png)](https://doc.redisage.com/uploads/images/gallery/2025-01/c10image.png)

# Ethernet

## {{@264#bkmrk-open-iot-and-iiot-ga}}


Link to repositories:

- [C](https://github.com/Redisage/STM32_Open_IoT_and_IIoT_Gateways_examples/tree/main/Ethernet_IP_example)

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-02/scaled-1680-/Wp0image.png)](https://doc.redisage.com/uploads/images/gallery/2025-02/Wp0image.png)

This example allows you to check the Gateway's IP address. Connect the device via USB/UART converter and choose correct COM/ttyUSB port. Remember to connect the IoT Gateway to the network using an Ethernet cable. Type in terminal "ipconfig". If your network connection works properly, IP address will be displayed as below:

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-01/scaled-1680-/dJBimage.png)](https://doc.redisage.com/uploads/images/gallery/2025-01/dJBimage.png)

# I2C scanner

## {{@264#bkmrk-open-iot-and-iiot-ga}}


Link to repositories:

- [C](https://github.com/Redisage/STM32_Open_IoT_and_IIoT_Gateways_examples/tree/main/i2c_scanner)

A simple program for scanning and displaying addresses of connected devices via I2C bus.

[![image.png](https://doc.redisage.com/uploads/images/gallery/2025-01/scaled-1680-/WTOimage.png)](https://doc.redisage.com/uploads/images/gallery/2025-01/WTOimage.png)