Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Arduino and CH-05 Bluetooth module, modify the code to add a C switch statement. When buttons 1-9 are pressed on a cell phone app,

Using Arduino and CH-05 Bluetooth module, modify the code to add a C switch statement. When buttons 1-9 are pressed on a cell phone app, the switch statement should decode the message (i.e. b1?, b2?, etc.) and print a more complex message to the Serial Monitor (i.e. Button 1 pressed, Button 2 pressed, etc.).

The code:

#include

const byte rxPin = 0; const byte txPin = 1; SoftwareSerial BTSerial(rxPin, txPin);

void setup() { pinMode(rxPin, INPUT); pinMode(txPin, OUTPUT); Serial.begin(38400); // Usually 9600 for BT mode, although it is sometimes 38400: BTSerial.begin(9600); }

void loop() { if(BTSerial.available()) { Serial.print("Rx Byte "); Serial.print((char)BTSerial.read()); } if(Serial.available()) { BTSerial.print((char)Serial.read()); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

Who uses information from an accounting system?

Answered: 1 week ago

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago