OneSheeld fundamental library methods

This tutorial explains the fundamental functions used by OneSheeld library, like starting the communication, waiting till the application connects to the board or inserting some delay in your sketch without missing any data from the application.
Let’s start by listing them ;),

Functions:

1) begin()
2) isAppConnected()
3) waitForAppConnection()
4) delay(unsigned long)
5) isCallbacksInterruptsSet()
6) enableCallbacksInterrupts()
7) disableCallbacksInterrupts()
8) setOnSelected(void (*userFunction)(void)

 

void begin(void)

Sets serial communication baudrate at 115200 by default.

SYNTAX

OneSheeld.begin();

RETURN

None.

PARAMETERS

None.

USAGE

 

bool isAppConnected(void)

Checks if the app is still connected to the 1Sheeld board.

SYNTAX

OneSheeld.isAppConnected();

RETURN

Boolean Yes ‘1’ or No ‘0’.

PARAMETERS

None.

USAGE

 

void waitForAppConnection(void)

Hangs your sketch until the app connects to 1Sheeld board.

SYNTAX

OneSheeld.waitForAppConnection();

RETURN

None.

PARAMETERS

None.

USAGE

 

void delay(unsigned long)

Unlike Arduino’s delay, OneSheeld’s delay still listens to incoming frames, while Arduino delay Freeze the system and miss incoming data. Use OneSheeld delay if you are using any of 1Sheeld input shields.

SYNTAX

OneSheeld.delay(timeInMilliseconds);

RETURN

None.

PARAMETERS

Unsigned long number representing time in milliseconds.

USAGE

 

bool isCallbacksInterruptsSet(void)

Checks if callbacks interrupt are enabled for OneSheeld library.

SYNTAX

OneSheeld.isCallbacksInterruptsSet();

RETURN

Boolean Yes ‘1’ or No ‘0’.

PARAMETERS

None.

USAGE

 

void enableCallbacksInterrupts(void)

Enable callbacks interrupts for all shields.

SYNTAX

OneSheeld.enableCallbacksInterrupts();

RETURN

None.

PARAMETERS

None.

USAGE

 

void disableCallbacksInterrupts(void)

Disable callbacks interrupts for all shields.

SYNTAX

OneSheeld.disableCallbacksInterrupts();

RETURN

None.

PARAMETERS

None.

USAGE

 

void setOnSelected(void (userFunction)(void)

Sets a certain individual function coded by the user in the sketch to be called and runs its functionality once certain shield is selected. This is a parent function, each shield inherits this functionality to check if it was selected at the application or not,so it’s useful if you want to run certain tasks once you select that certain shield.

SYNTAX

Mic.setOnSelected(&userFunction);

RETURN

None.

PARAMETERS

&userFunction takes the physical address of your created function in the memory, and called once new data received to execute it’s functionality.

USAGE

 




Related Blogs

Arduino IoT

Arduino IoT Shield Functions Explainer

Arduino makers …. you can connect your Arduino to MQTT brokers(servers) and launch your IoT with Arduino IoT Shield! It’s the 1Sheeld IoT shield that will do the job for you. It’s one of the most important but recent Arduino shields in 1Sheeld. Simply, it turns your Arduino into MQTT client where you can publish and …

Arduino Temperature Humidity System

IoT Arduino Temperature and Humidity System

Monitor my home environmental parameters remotely is one of the most desirable things I have ever wanted to make. It’s not about purchasing such a system that can get the job done for me. But, passion to create it myself. So, today, I am going to connect the popular DHT sensor to an online MQTT …

Arduino Door Lock

IoT Arduino Door Lock using 1Sheeld and Smartphone

  “Oh God! … It seems like I have forgotten the door lock open, again” … the normal saying whenever I am in hurry to go out! Have you encountered this problem before? It always confuses me since I may even think that I have left the door lock opened, and once I go back, …

IoT Fan Control

Arduino IoT Fan Control using 1Sheeld and Smartphone

Here I am with another IoT-based home automation project; Arduino IoT Fan Control. Every day, I get back from work tired and feeling hot. No air conditioner here and the fan takes much time to start cooling the room, sadly! So, I was thinking why not controlling the fan from outside my home with my …

Arduino Light Control

IoT Arduino Light Control using 1Sheeld and Smartphone

Have you ever forgotten to turn your home lights off when you got outside? Sadly, it happens to me all the time. And this causes confusion once I get my bills! Furthermore, here is one secret about me; I am a lazy man. I always want to control my room lamp from my sweet bed. …

mqtt-protocol

MQTT Protocol – How it Works

MQTT is one of the most commonly used protocols in IoT projects. It stands for Message Queuing Telemetry Transport. In addition, it is designed as a lightweight messaging protocol that uses publish/subscribe operations to exchange data between clients and the server. Furthermore, its small size, low power usage, minimized data packets and ease of implementation …