Giter Club home page Giter Club logo

msp432-hc-05's Introduction

MSP432 HC-05

We all have used this! The venerable HC-05 Bluetooth module. These modules are so simple to use and hook up, that you can have a Bluetooth communication link working in minutes! ๐Ÿ˜„


Project Setup


In order to use the project you will need to have the MSP432 SimpleLink SDK library installed. To install it follow the link and select the SIMPLELINK-MSP432-SDK option, after the installation is complete import this project into Code Composer's Workspace.

The HC-05 project is divided into two folders:

  • Hardware: This folder contains all hardware peripheral code

  • Devices: This folder contains MSPIO

IMPORTANT: This project will require a serial terminal on a computer and a bluetooth terminal on an android device open. Use your preferred serial terminals.

How to use it


Include the following header files

#include <Hardware/CS_Driver.h>
#include <Devices/MSPIO.h>

Initialize all the necessary hardware peripherals as follows:

void main()
{
	MAP_WDT_A_holdTimer();

    /*MSP432 Running at 24 MHz*/
	CS_Init();

	/*Initialize required hardware peripherals for the ESP8266*/
	/*We are using UART A0 for UART PC*/
	UART_Init(EUSCI_A0_BASE, UART0Config);
	/*UART A2 is used for the HC-05*/
	UART_Init(EUSCI_A2_BASE, UART2Config);

    MAP_Interrupt_enableMaster();
}

To communicate to the HC-05 you will simply call the MSPIO MSPrintf function and pass as arguments the UART base address and the formatted string

/*simple string*/
MSPrintf(EUSCI_A2_BASE, "Hello HC-05");

/*Or formatted string*/
char c = 'e'
int no = 1234;
char str[] = "I am a string";
MSPrintf(EUSCI_A2_BASE, "%c, %i, %s", c, no, str);

You can also wait for input from the HC-05 Bluetooth module by calling the MSPgets function

const int BUFFER_SIZE = 128;
char Buffer[BUFFER_SIZE];

/*Wait for input coming from the HC-05, will not return until a '\r' or '\n' is received*/
MSPgets(EUSCI_A2_BASE, Buffer, BUFFER_SIZE);

if you want to print the received string coming from the HC-05 you will simply use the MSPrintf function, but this time you will pass the UART base address of the PC UART (EUSCI_A0_BASE)

MSPrintf(EUSCI_A0_BASE, "%s", Buffer);

The same is true if you want to wait for input coming from the PC UART

MSPgets(EUSCI_A0_BASE, Buffer, BUFFER_SIZE);

Other Details and Future Work


THIS DOES NOT WORK FOR IOS! Unfortunately IOS has a limited list of bluetooth profiles that can recognize, the HC-05 profile is not among those ๐Ÿ˜ž. You will need an Android device and a bluetooth terminal to make this work.

For some reason some of the android terminals send an extra carriage return. If you encounter this problem, select the "append carriage return only" option. Most Bluetooth serial terminals have this option


msp432-hc-05's People

Contributors

amartinezacosta avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.