EasyManua.ls Logo

Digi XBee 3 User Manual

Digi XBee 3
293 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #40 background imageLoading...
Page #40 background image
Get started with MicroPython Example: code a request help button
Digi XBe 3 Cellular LTE Cat 1 AT&T Smart Modem User Guide
40
On the board you see DIO0 written below SW2, to the left of the button. This represents the pin that
the button is connected to.
In MicroPython, you will create a pin object for the pin that is connected to the SW2 button. When you
create the pin object, the DIO0 pin is called D0 for short.
The loop continuously checks the value on that pin and once it goes to 0 (meaning the button has been
pressed) a print() call prints the message Button pressed! to the screen.
At the MicroPython >>> prompt, copy the following code and enter it into MicroPython using paste
mode (Ctrl+E), right-click in the Terminal, select Paste to paste the copied code, and press Ctrl+D to
run the code.
# Import the Pin module from machine, for simpler syntax.
from machine import Pin
# Create a pin object for the pin that the button "SW2" is connected to.
dio0 = Pin("D0", Pin.IN, Pin.PULL_UP)
# Give feedback to inform user a button press is needed.
print("Waiting for SW2 press...")
# Create a WHILE loop that checks for a button press.
while (True):
if (dio0.value() == 0): # Once pressed.
print("Button pressed!") # Print message once pressed.
break # Exit the WHILE loop.
# When you press SW2, you should see "Button pressed!" printed to the
screen.
# You have successfully performed an action in response to a button press!
Note You can easily copy and paste code from the online version of this guide. Use caution with the
PDF version, as it may not maintain essential indentations.
Note If you have problems pasting the code, see Syntax error at line 1. For SMS failures, see Error
Failed to send SMS.

Table of Contents

Other manuals for Digi XBee 3

Question and Answer IconNeed help?

Do you have a question about the Digi XBee 3 and is the answer not in the manual?

Digi XBee 3 Specifications

General IconGeneral
ModelXBee 3
CategoryModem
Frequency Bands2.4 GHz, 868 MHz, 900 MHz
InterfaceUART, SPI, I2C
Operating Temperature-40° C to +85° C
Power Supply2.1V to 3.6V
AntennaExternal or onboard
Transmit Powerup to 20 dBm
SecurityAES encryption
ProtocolsZigbee, 802.15.4, DigiMesh

Summary

Getting Started with the XBee Smart Modem

Connect Hardware and Install XCTU

Step-by-step instructions for connecting hardware and installing XCTU utility.

Update Firmware and Check Connection

Procedures for updating device firmware and verifying cellular connection status.

XBee Connection Examples

Getting Started with MicroPython

MicroPython Basics and Setup

Introduction to MicroPython and setting up the environment using XCTU.

Update the Firmware

Update Device and Cellular Firmware

Procedures for updating device and cellular firmware using XCTU.

Update Telit Modem Firmware with XFP Utility

Instructions for updating the Telit modem firmware using the XFP utility.

AT Commands Reference

Special, Cellular, and Network Commands

Reference for special, cellular, and network configuration AT commands.

I/O, Sleep, and Mode Commands

Configuration commands for I/O settings, sleep modes, and operating modes.

File System, BLE, Socket, and API Commands

Commands for file system, BLE, sockets, and API frame management.

Troubleshooting Guide

Related product manuals