Loading...

You have no items in your shopping cart.

 
 
 
×

Registration

Profile Informations

Login Datas

or login

First name is required!
Last name is required!
First name is not valid!
Last name is not valid!
This is not an email address!
Email address is required!
This email is already registered!
Password is required!
Enter a valid password!
Please enter 6 or more characters!
Please enter 16 or less characters!
Passwords are not same!
Terms and Conditions are required!
Email or Password is wrong!
Captcha is required!
Captcha is wrong!

ITEAD OS GPIO And UART Operation Demo

Here we would like to post a video to demonstrate how to use GPIO on Iteaduino Plus to drive LED and to use UART to control SIM900 module.

First, let’s make hardware connection. Connect the Iteaduino Plus to LED with DuPont wire, and then ON/OFF of the LED lamp can be controlled by the high or low-level output of GPIO. Here, the connected pin is pin 144.

Then connect the peripherals such as monitor, mouse and keyboard, the system can be started after powering up. After entering the ITEAD OS, create a new file – currently SDK supports C files and PY files.

As shown in the video, right-select "create new" -> "Blank File" to create a file test.c in the location where you want to save the file.

Double-click the file, it will be opened with the default text editor, and then we can write our control code in it:

#include 
int pin=144;

int main()
{
pinMode(pin, OUTPUT); 
while(1)
{
digitalWrite(pin, HIGH); 
delay(1000); 
digitalWrite(pin, LOW); 
delay(1000);
}
}

Note that the file must begin with “# include <itead.h>” including the header file, so that the various functions provided by SDK can be properly called later.

In this demo code we only use two GPIO functions:

  • pinMode ()
  • digitalWrite ()

which are to set GPIO as output and to control the output level of the GPIO interface respectively. For details about functions, you can find in file "ITEAD OS BETA SDK functions manula".

After writing the code, we need to save the file. Use shortcut key combinations “ctrl + alt + t” to bring up the terminal box, and then use command “cd” to navigate path to the saved file as shown in the video. In the video, we also used command “ls” to display file under the path to ensure the correct location of the file.

Then we can use command “iteadcompile” offered by us to compile the file, the command format is as follows:

Iteadcompile  "output file name"  "name of file to be compiled"
As in the video, to compile file test.c to an executable file named test, you can use command

	iteadcompile test test.c

Next, press the Enter key. After finishing execution, we can find another executable file generated under the file directory. Then we can use command “sudo” to execute the file, the execution result is as shown in the video, LED lamp will be controlled by GPIO for ON and OFF by turns.

The operation of controlling SIM900 module to make phone calls is similar to that of above. First, SIM900 module should be connected to Iteaduino Plus, then enter operating system, create a new file gsm.c and write control code:

#include 

int main()
{
 SerialBegin(UART4,9600);
 while(1)
{
 Serilprintln(UART4,"ATM13612345678");
 delay(3000);
}
}

In the example, we used two UART functions:

  • SeiralBegin()
  • SeiralPrintln()

Which are to initialize UART settings as well as output string through the UART. Code is quite simple, that is, after configuring UART, output an AT commands string through the serial port every three seconds, so SIM900 module can dial a number.

Same as that in the last example, compile and run file gsm. Then Iteaduino Plus will send AT commands to control GSM module to make phone calls via UART port continuously. Here we made a small mistake, before running the program, we forgot to press Power on button on the GSM module to start SIM900 module. However, that's okay, because control commands in the code are sent out repeatedly, after we press the Power on button to start SIM900 module and find the wireless network, it will dial the number set in our code.

That’s all about the two small DEMOs that are relatively simple. Later on, we will continue to provide operation functions for IIC and SPI interfaces as well as operation functions for many modules such as GMS module, and we will provide direct operation functions so that users will not need to send the corresponding AT commands any more.